To get the most out of this book
Each great journey begins with a humble step. Our upcoming adventure with Go programming is no exception. Before we can do awesome things using Go, we need to be prepared with a productive environment. For this book to best serve you, you should install Git, Docker, and Go version 1.21 or higher. It is recommended that you have 4GB of RAM, and virtualization enabled in BIOS (usually enabled by default). The book is best suited for macOS or Linux, and will require minor tweaks for using Windows equivalent commands if needed. It is recommended to use a 1.6 GHz or faster desktop processor.
A helping hand on additional setup:
Install the Go Compiler
To turn your Go source code into something you can run, you’ll need the Go compiler. For Windows and macOS, we recommend using the installer. Alternatively, to get more control you can download precompiled binaries. You can find both at https://packt.live/2PRUGjp. The install instructions for both methods on Windows, macOS, and Linux are at https://packt.live/375DQDA. The Go compiler is free to download and use.
Install Git
Go uses the version control tool Git to install extra tools and code. You can find the instructions for Windows, macOS, and Linux at https://packt.live/35ByRug. Git is free to install and use.
Install Visual Studio Code (Editor/IDE)
You need something to write your Go source code. This tool is called an editor or an Integrated Development Environment (IDE). If you already have an editor you like, you can use it with this course if you’d like to.
If you don’t already have an editor, we recommend you use the free editor Visual Studio Code. You can download the installer from https://packt.live/35KD2Ek:
- Once it’s installed, open Visual Studio Code.
- From the top menu bar, select View.
- From the list of options, select Extensions.
- A panel should appear on the left side. At the top is a search input box. Type
Go
. - The first option should be an extension called Go by Microsoft.
- Click the Install button on that option.
- Wait for a message that says it’s successfully installed.
If you have Git installed, follow these steps:
- Press Ctrl/Cmd + Shift + P all at the same time. A text input should appear at the top of the window.
- Type
go tools
. - Select the option labelled something like Go: Install/Update Tools.
- You’ll see a list of options and checkboxes.
- The very first checkbox next to the search input checks all the checkboxes. Select this checkbox, then select the Go button to the right of it.
- A panel from the bottom should appear with some activity in it. Once this stops (and it may take a few minutes), you’re all done.
Once done, select View from the top menu bar, then select Explorer.
Install Docker
Docker allows us to run things such as database servers without having to install them and containerize our applications. Docker is free to install and use.
For macOS users, follow the instructions at https://packt.live/34VJLJD.
For Windows users, follow the instructions at https://packt.live/2EKGDG6.
Linux users, you should be able to use your built-in package manager to install Docker. Instructions for common distributions are at https://packt.live/2Mn8Cjc.
You are safe to uninstall Docker, if you wish, once the book is complete.
Install PostgreSQL
PostgreSQL is used within the chapter covering database interactions. To install the PostgreSQL driver, follow the instructions at https://www.postgresql.org/download/.
If you are using the digital version of this book, we advise you to type the code yourself or access the code from the book’s GitHub repository (a link is available in the next section). Doing so will help you avoid any potential errors related to the copying and pasting of code.