quivalent, full-featured IDEs for Go. So what’s the best IDE for Golang? After trying several options which included LiteIDE, IntelliJ Go Plugin, Go-IDE and Atom, I personally settled on using Sublime Text and iTerm.
Sublime Text
Sublime Text 3 along with the GoSublime package provides several features to improve Go programming productivity. I also setup a Sublime Project for each of my Go projects which contains a sublime-project file and sublime-workspace file. If your project needs specific environment variables you can set those in your sublime-project file by adding the following:
{
"settings": {
"GoSublime": {
"env": {
"APP1_ENV": "test",
"APP1_HOME": "/var/app1"
}
}
}
}
When getting started with Sublime, I stubbled upon the Get Go-ing with Sublime post by Tyler Bunnell which contains several tips and tricks when using Sublime and GoSublime. If you decide to use Sublime, I encourage you to check out Tyler’s post. The best tip is customizing the preferences to run `go build` and `go test` upon saving a go file which I slightly modified. Below are the Gosublime preferences I use:
{
"on_save": [
{
"cmd": "gs9o_open",
"args": {
"run": [
"sh",
"go build && go test -i && go test && go fmt && go vet"
],
"focus_view": false
}
}
],
"autocomplete_closures": true,
"complete_builtins": true,
"fmt_cmd": [
"goimports"
]
}
In addition to using the GoSublime package, I also use the SublimeGit and GitGutter packages to interact with GitHub. When I am ready to run my application, I use iTerm2 instead of trying to run in the GoSublime console. Sublime Text along with the numerous packages provide a ton of shortcuts and features to improve productivity.
Setting up my current Go development environment did not happen overnight. In fact, I spent numerous hours researching and eva luating different tools, best practices and conventions. I encourage you to find a setup that works best for you and hopefully this information will save you a couple of hours!