Its been 2+ years since the last environment post that I could find. Any new additions to the Go world that we should consider adding to our everyday workflows?
Im fairly newish to Go, mainly just learning the syntax and what not, but as of right now I just use Atom + a couple of ITerm windows. Curious to see what else is out there.
评论:
redditbanditking:
inferiormartin:I use vim, so vim-go is pretty good. It does go fmt automatically every time you save. It has a bunch of other shortcuts for common go commands.
I am still waiting a good Go IDE (looking at you, JetBrains), that can refactor, remove unused imports automatically, insert imports automatically, insert
if err != nil
templates.edit: apparently I put the wrong link.
comrade-jim:Gogland is pretty good although still in early development. There's also the Go plugin for IDEA
borring:+> refactor, remove unused imports automatically, insert imports automatically, insert if err != nil templates.
Learn to use Vim and vim-go. They can do all that.
ChristophBerger:Vim-go should be using goimports instead of gofmt. That pretty much takes care of most of what you just said.
comrade-jim:Any editor that uses Go plugins with support for
goimports
,goreturns
, and the like can insert and remove imports automatically.Visual Studio Code has template inserting capabilities, and I believe the Go extension even comes with an
if err != nil
template by default.Refactoring is another story. VSC helps with features like "Find all references" etc, but so far I don't know of an Editor/IDE with full refactoring support (disclaimer: I do not constantly observe the current state of Go IDE's and editor plugins.)
A couple of command-line tools can help with refactoring, see e.g. here.
ChristophBerger:FYI, Visual Studio Code doesn't have nearly as many features as vim-go:
https://github.com/microsoft/vscode-go
https://github.com/fatih/vim-go
In my experience, there is also noticeable lag when working with large Go projects in VSCode, even when turning off the blinking cursor (people keep telling me the cursor uses 13% CPU).
tmornini:I would not necessarily agree that the list of vscode-go features is shorter than that of vim-go. The more important question is how many, and which, of these features you actually use for everyday work.
I can only speak for myself, but I switched from Vim to VSC a while ago and I do not miss any particular feature.
Regarding "13% CPU", I just tested this and found that a blinking cursor does not affect CPU load in any way. Maybe this has been true for older versions of VSC.
darkmagician2:Atom on external monitor left side, terminal on right side, chrome on laptop screen.
Boom!
Planning a switch to Linux from MacOS soon.
WeeniePistols:Atom in 2017? Ouch.... Move to VS Code plz :)
disq:I like Atom a lot actually. Its just simple, VS Code is quite nice as well i guess it was just which I used first.
- Gogland + its built-in terminal window bound to F13 key (full-size mac keyboard)
- Lots of middle-clicking on symbols, reading godoc comments and code in external (or standard) library sources that way.
WeeniePistols:Built-in terminal is a great feature. VSCode also has it.
GoTheFuckToBed:yeah I installed the Atom terminal plugin, built in terminal but seem to always default back to two monitors and iTerm on one and Atom on the other.
justinisrael:
- install go
- Visual Studio Code
- install the go extension (it will install the extra tools)
done, it uses the default path
justinisrael:I only ever set $GOPATH and $GOBIN, unless I have done a custom installation of go from source, in which case I would also set $GOROOT (but less common).
But none of this has changed for me since go 1.0
Edit : And I only set a single path on $GOPATH
WeeniePistols:I just realized you are also asking about editors and workflows. You are going to hear a large mixture of editors. I still use SublimeText3, and have been recently using AnacondaGO plugin. I don't use build system configurations from my editor. I prefer to just have the side-car terminal window.
comrade-jim:haha yeah, i figured you probably glazed over the question at first look. Thanks for the updated answer!
driusan:I use vim and vim-go because it's the most feature complete editor/plugin. Using it inside tmux I can use delve, but no one at the company I work for uses a debugger.
I've tried sublime, atom, and Visual Studio code and none of them even come close.
joeyGibson:I use a text editor that I wrote and a shell or two. (About half the time sh on DragonFlyBSD and half the time rc on 9front.)
I suspect I'm in the minority.
WeeniePistols:I use Gogland, though I hope to switch back to IntelliJ + the Go plugin, once it is at parity with Gogland. The main thing that is keeping me from using IntelliJ right now is the lack of the ability to run
gofmt
on file save, like Gogland provides.
joeyGibson:oh I just googled Gogland and its the new in work JetBrains IDE. Yeah, im pretty pumped for that, but ill probably wait until they work out most of the bugs.
de_joerg:I use it daily at work, and I've found it to be rock solid.
WeeniePistols:Also using Gogland on Mac, its pretty solid.
vi-to-emacs-evil168:Thats great to hear, Im all about the JetBrains suite of IDE's.
joeyGibson:I had read that the dev for gogland was then intellij plugin dev too and he no longer planned to maintain the plugin. Hope I'm wrong here.
Kraigius:I read somewhere that they will eventually get the plugin to parity with Gogland, but it's not s priority right now. I hope they do, because we use Cucumber and Ruby for testing, and it would be nice to do all my editing in IntelliJ.
Gogland is the shit, I highly recommend it. Auto goftm on save, code completion, detection of errors, type information when hovering on variables...everything expected of a fully fledged IDE. I encountered some bugs when debugging (ie: either not stopping on breakpoints or not loading the variables in the inspector) but other than that nothing.
