This is a created article in which the information may have evolved or changed.
1. Installation Steps
A. Download the SDK and unzip it to your favorite directory (you need to configure the path later)
B. Configure the path, there are many places can be configured to refer to this chain (path configuration in detail), I am directly modified ~/.bash_profile to set the environment variable, because the file can be changed by the general user, there is no permission issues involved, specifically refer to this link rough configuration. Enter in this file
Export goroot= $HOME/go
Export gopath= $HOME/go: $HOME/mygo
Export path= $PATH: $GOROOT/bin: $GOPATH/bin
Where Goroot corresponds to the previous go source package decompression path, Gopath can set a number to see where you want to create a new row, press: separate on the line as shown above
is so simple, the environment is configured, you can enter go at the command line to see if the installation is successful
2. Directory structure
A. Above I have linked a new Gopath:mygo, at this time switch to the folder under the new SRC folder (Go source folder, you need to build, not automatically generated)
B. Generally a complete go program below includes three subfolders of Src bin pkg.
Inside the bin is executable file through go install executable file, install the go file must contain the package main to produce the executable file
The pkg is filled with some corresponding. A file build can appear
C. So when you need a new go package, create a new folder under the SRC folder name is the same as the name of the go package you want, then just the code.