After installing the Go language, but also to set the path, if you do not set the path, the execution of Go will prompt Go:command not found, the hint means that there is no command line. This is because the path is not set yet.
The way to set the path is vi ~/.bash_profile, go in the first line to add a row of export path= $PATH:/usr/local/go/bin, you can.
Then make the profile effective: source ~/.bash_profile
1, Goroot is the Go installation path
2, Gopath
go install
/ go get
and go tools are used to 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.
- Do not set the Gopath as the Go installation path
LINUX/MAC GO environment variable configuration