We’ve frankly been learning Golang for quite some time now, and perhaps there is no better time than the present to look for an IDE for yourself. We are devoted to the Open Source, so here I bring you 5 open-source IDEs that have cross-platform support.
IDE stands for Integrated Development Environment.
Best Golang IDE – A Quick Summary List
For the impatient ones, here is the quick list of the best Golang IDE.
- VS Code
- VIM
- Eclipse
- Atom
- Sublime Text
Now, let’s have a brief introduction of these Go IDEs.
1. VS Code – Visual Studio
Install Go within VS using:
ext install golang.Go
This extension has a wide range of features, including Intellisense, code navigation, and code editing support. It also shows build, vet, and lint diagnostics as you work and provides enhanced support for testing and debugging your programs.
This extension needs no configuration; it works out of the box. But the default settings can easily be customized. In fact, that is a feature common to all the IDEs listed.
LanguageServer
In the default mode, the Go extension relies upon a suite of command-line tools. A new alternative is to use a single language server, which provides language features through the Language Server Protocol.
The Go team at Google has developed gopls
, which is the official Go language server.
To opt-in to the language server, set "go.useLanguageServer"
to true
in your settings. You should then be prompted to install gopls
. If you are not prompted, you can install gopls
manually by running the Go: Install/Update Tools
command and selecting gopls
.
2. Vim
The vim-go is the official name of the plugin that enables Vim to use Go.
This plugin adds Go language support for Vim, with the following main features:
- Compile your package with
:GoBuild
, install it with:GoInstall
or test it with:GoTest
. Run a single test with:GoTestFunc
). - Quickly execute your current file(s) with
:GoRun
. - Improved syntax highlighting and folding.
- Debug programs with integrated
delve
support with:GoDebugStart
. - Completion and many other features support via
gopls
. - formatting on save keeps the cursor position and undo history.
- Easily import packages via
:GoImport
, remove them via:GoDrop
. - Precise type-safe renaming of identifiers with
:GoRename
. - Lint your code with
:GoLint
, run your code through:GoVet
to catch static errors, or make sure errors are checked with:GoErrCheck
. - Advanced source analysis tools utilizing
guru
, such as:GoImplements
,:GoCallees
, and:GoReferrers
.
You can display the full documentation for vim using :help vim-go
3. Atom
The next one on our list is Atom, which I’ve used quite frequently myself. It boasts quite a list of features:
- Will highlight folders, files, and lines that have any uncommitted edits made. It also integrates really well with GitHub.
- Atom was built from the ground up with the community in mind, and package management is a first-class feature – Installing Atom adds two command line commands – atom and APM. The first one runs the application itself and the second one is the Atom Package Manager that’s used to add and remove various components from the package listing. While these features can be set up with other editors as well, Atom takes care of them out of the box.
- Modular – Even the base Atom editor comes with a lot of plugins installed already. The most essential features are official plugins from the Atom team so you don’t have to hunt them down.
- Extendable – Due to its modular design, almost any aspect of the editor can be changed. Even seemingly core packages, like those taking care of search and replace functionality, can be forked on GitHub and changed and replaced in the editor. The documentation for creating new plugins is also great, making it easier for developers to jump in and create plugins for Atom.
- Ctrl + Shift + P – The Command Palette permits fuzzy searching all available functions, settings, snippets, etc.
However, since Atom is not truly an IDE but a highly modular text editor, you will have to take the time to find and install plugins you need to make it work as a true IDE. It may also tend to crash or hang with large >(10MB) text files, making it less useful as a general text editor. The lag is especially noticeable on larger projects. It also opens a surprising amount of sub-processes and leaks a considerable amount of memory.
4. Eclipse
GoEclipse to be precise, is an amazing IDE and a huge name in the industry.
Because Eclipse is based on SWT, it uses the native font rendering and thus looks better than other IDEs on some Linux systems, where the font rendering is not optimal.
Thanks to the large variety of plugins and various configuration options, Eclipse is very customizable. However, though there are plenty of plugins to choose from, they aren’t always reliable. Some aren’t maintained, bug fixes can be slow, and you may need to download plugins from multiple sources.
4. Sublime Text
Sublime Text also comes well recommended from numerous well-known programmers on YouTube. The features are similar to Atom, with improvements in some:
- Sublime Text has a minimap on the side that provides a top-down view of the file and keyboard shortcuts for most actions. It also supports a large number of languages and general text editing features out of the box.
- Beginner-friendly – Does not drown you in keyboard shortcuts or unintuitive concepts as you start using it, but high-level functionality can still be easily accessed when the need for it arises.
- Text from the current file is used to provide autocomplete
- Project Support (folder browsing, scoped history, build-system declarations)
- Refactoring support is emulated through multi-select, project-wide find & replace, and regular expression search
- Syntax-aware selection and GoTo for quickly jumping to locations in the project
- Snippets & Macros
However, unlike the Atom editor, Sublime Text protects and copyrights its code and is thus not the freedom-ware some would like it to be. GoSublime may also be unreliable due to its badly written code base.
References
- https://github.com/fatih/vim-go/blob/master/doc/vim-go.txt
- https://marketplace.visualstudio.com/items?itemName=golang.go
- https://go.dev/doc/editors