January 2018
Intermediate to advanced
340 pages
8h 6m
English
The go build tool is good for generating an executable file in your current working directory, but there is a way to build and install your applications so that the executables are all collected in the same location.
When you run go install it puts the output file in a default location of $GOPATH/bin. In our case, we set $GOPATH equal to our $HOME. So the default bin directory would be $HOME/bin.
You can override the location by setting the GOBIN environment variable if you want it to install somewhere else. To install our hello program, we will run the following command:
go install hello
This will build and create an executable file, ~/bin/hello. The bin directory will get created automatically if it does not ...
Read now
Unlock full access