Transferred from: http://blog.studygolang.com/2012/12/go%E9%A1%B9%E7%9B%AE%E7%9A%84%E7%9B%AE%E5%BD%95%E7%BB%93%E6%9E%84/
How the project directory structure is organized, the general language is not specified. But the go language is a rule, so you can maintain consistency. 1, General, a go project under Gopath, there will be the following three directories:
Where the bin holds the compiled executable file, the PKG holds the compiled package file, and SRC holds the project source file. Generally, the bin and pkg directories can be created without the GO command being created automatically (like go install), just create the SRC directory.
For the Pkg directory, someone once asked: I put the package go under the pkg, how can not ah. He directly put the go package source files into the pkg. This is obviously wrong. The files in the pkg are generated by go compilation, rather than manually put in. (General file suffix. a)
For the SRC directory, the source files are stored in the go, and the source files are organized in the form of packages. In general, creating a new package creates a new folder in the SRC directory. 2. Examples and explanations
For example: I create a new project, test, the starting directory structure is as follows:
In order to compile conveniently, I added an install file in it, directory structure:
The contents of the install are as follows: (Linux)
4 |
Echo ' Install must is run within its container folder ' 1>&2 |