This is a creation in Article, where the information may have evolved or changed.
Download Address: https://dl.gocn.io/
Linux Download address: wget https://dl.gocn.io/golang/1.9.2/go1.9.2.linux-amd64.tar.gz
goroot is the installation path to go, gopath, go Install
/ go get
and go tools use Gopath environment variables. gopath is the search path as the compiled binary storage destination and import package (in fact your working directory, you can create your own go source file under SRC and then start working).
- Gopath consists of three main directories: bin, pkg, SRC
- The bin directory mainly contains executable files; Pkg directory to store compiled library files, mainly *.a files; The source files of go are mainly stored in the SRC directory.
To configure environment variables:
VI ~/.BASHRC
Export goroot=/usr/ Local /go
Export path= $GOROOT/bin: $PATH
export gopath=/usr/ /gopath
Export path= $GOPATH/bin: $PATH
SOURCE ~/.BASHRC