A Basic Go Setup
In this article, I wanted to share the setup I use for writing data science programs in Go. I’ve found it very easy to get started with this language, but thought it might be useful to describe the setup.
I use both Linux and a Mac, so this article will describe those platforms, but Go should work well on Windows as well. In any case, we assume that you are comfortable running the command line.
Installing the Go compiler and tools
First of all, install Go itself. On Linux, use your package manager, e.g., on Arch Linux it would be:
pacman -S go
On Mac OS, you can either use Homebrew:
brew install go
Or download and run the installer from https://go.dev/dl
Either way, you should be able to run the go program to get the version, e.g.,
go version
Choosing an editor or IDE
Go programs are just text files, so you can use any editor. Many editors have plug-ins to support Go programming, so you will want to look into these. I use vim, and have found go-vim quite useful.
If you like something bigger, this page describes various Integrated Development Environments (IDEs). The most widely used seem to be VS Code (free but not open source) with this extension, and GoLand (commercial product requiring a paid license) from JetBrains, the makers of PyCharm for Python.
And my favorite option has become LiteIDE, a simple and small open-source IDE specifically for Go. It can be downloaded and installed from the above link (or using your package manager on Linux). I like LiteIDE’s simple project architecture (just a directory containing code), debugging support, and simple interface, which has buttons to build, run, and test your code.
In the next post, I’ll assume you’ve set up Go and your favorite editor or IDE, and will describe how to create and run a simple program.