Go is a programming language that advocates the concept of software engineering.
The code for Go must be placed in the workspace. The workspace is actually a directory that corresponds to a specific project, and it should contain three subdirectories: SRC is used to organize and save the go source file in a code package. Should be divided into three categories: library source files, command source files, test source files.
Pkg is used to store the ". A" archive of the installed code package (the library source file) that is built by the Go Install command. Similar to the PKG functionality in the Goroot directory, the difference is that the PKG directory in the working directory is designed to hold the file for user code. Bin saves the executable file generated by the GO command source file after the installation is completed through the Go Install command.
PS: The so-called command source files, which can be run independently, can be the go build or goes install command to convert to executable files. A library source file refers to a generic source file in a code package.
Set Gopath
Copy Code code as follows:
$vim/etc/profile Export gopath= $HOME/golang/lib: $HOME/golang/learngo
$source/etc/profile
$HOME/golang/lib is used to store a third party code base (get access command)
$HOME/golang/learngo to store learning code
The above is the entire content of this article, I hope you can enjoy.