Starting Go development requires the installation of the Go binaries as well as setting up the development environment.
Download the Go binaries and follow the installation routine.
Open a terminal and check if go was successfully installed.
To create a workspace, where you will keep all your Go projects, just add a folder anywhere on your filesystem and put inside a
src and a
bin folder. The src folder will keep 1..n repositories which will be tracked by Git. Every Git repository will contain 1..n packages composed from 1..n Go source files in a single directory. Straightforward right? It's easier to show it in a screenshot.
As you can see, there are two repositories tracked by git inside of com.chevronsix/training/go. Usually a Go workspace contains many source repositories who contain many packages and commands.
GOPATH variable specifies the location of your workspace. To set a custom
PATH have a look here. To afterwards check your variable just type
GOPATH in your terminal. It will print the effective current
For convenience, add the workspace's
bin subdirectory to your
$ export PATH=$PATH:$(go env GOPATH)/bin
You are now good to go to create your first program.