Setting up a Local Environment for Developing Apps in Go
Learn about the third-party tools required to build an app in Go.
We'll cover the following
Tools required to build an app
Text editor
We will need to create files and folders for our app. This could be done either in an IDE, like GoLand, or a simple text editor, like Sublime.
We could also just use the CLI interface available on the system, such as Terminal in macOS.
Some of the advantages of using an IDE like GoLand are its following features:
Autosuggestion and autocorrection for syntax.
Easy switching between files and folders.
Great tools for building and running the application.
Out-of-the-box project setups that take care of creating dependency management files.
Integration with code management tools like GitHub.
It sounds very tempting to use an IDE, and in a real-world scenario, we probably should use one. However, to make things easy for the user, the IDE also does a lot of heavy lifting and abstracts things out, which to some users can be daunting.
Since we're only at the learning stage right now, and to understand how everything works, we'll go with a CLI and Vim (or any other text editor) for our project.
Install Go
The very first thing we need to execute the Go code is Go itself.
Installing Go is pretty straightforward. It can either be downloaded directly from its official download page, or we can download Homebrew to use a package management tool.
The process may vary slightly depending on your environment and OS. The links above have the appropriate instructions for all the environments. The following steps are how this will look in macOS.
Let's try to install Go using Homebrew.
For macOS, execute the following:
Get hands-on with 1400+ tech skills courses.