Setup to use Go - detailed instructions

16 seconds ago
Super great info from my friend Jamal Yusuf on how to setup AtomEditor with golang


The only thing I’m really missing is the I cannot CMD+click on a function. In IntelliJ I’m used to CMD+click on a function which opens the implementation. Adding this to atom would be the final thing for me :).

1 Like

ok and what about debugger.

Visual Studio Code offers pretty good code navigation. I was using Atom until I tried VS Code’s Go plugin. It’s cross platform and feels fast.

Unfortunately, the vim mode in VS Code is not as good as Atom. So, I’m still searching for the perfect Go setup.

Unfortunately Visual Studio Code does not have tabs. Right?

It does not have tabs. This is a UI choice that I actually like, although you have to get used to it. For me, tabs quickly become unwiedly. What I am usually looking for is “navigate forward” and “back”. Support for this is pretty good.

Regarding debugger, the Delve integration is good, although you will need to learn the JSON configruation format to specify your run configurations. If you need help with that, open a post about it here.

All in all, VS Code offers more out of the box, which is my style. The default git diff view is great. But hey, we’re talking editors here, so it’s everyone’s duty to fiddle with their setup. :slight_smile: YMMV.

Official plugin for Go:

Thanks for your info. If only VS code offered tabs as an option… i would definitely switch. Tried using it, but couldn’t get used to the missing tabs.

Verstuurd vanaf mijn iPhone

They started the decision process on the Vim support for Visual Studio Code

Vim keybindings is the only thing keeping me from moving completely to VS Code.

It is actually possible to jump to the definition of a function using godef. This is built-in to go-plus but you may not have been aware of it. The key binding is just not what you are used to:

I have different GOPATH on my computer, depending on the project I work on. I’ve been unable to make Atom work with one GOPATH per project. Anybody can help?

I use direnv. The Go plugins want to check that the Go tools are installed into GOPATH.
So make a common path for the tools and set your go path: GOPATH=/pathtoproject:/pathtocommontools

I do something like this:
/code/go << generic go path for tools.
/code/go/.envrc << with contents: “export GOPATH=/code”

I open Atom and create a dummy go file to make sure all go tools are installed from the plugins.

When I start a new project, I create a new directory:
/code/someproject/.envrc << with contents: “export GOPATH=/code/someproject:/code/go”

yeah, I missing that to. I have seen webstorm in action and seems really neat to be able to just CMD+click to get more info about a certain function

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.