This is a creation in Article, where the information may have evolved or changed.
In the actual project found that everyone's directory structure is more messy, basic everyone has the style of each person, a project is constantly getting bigger, some new files or directories are constantly added, from which to find the information they need more and more expensive, a unified general directory structure is very necessary.
The following is from this project on GitHub (Https://github.com/golang-sta ... )
/cmd
Main function file (e.g. /cmd/myapp.go
) directory, under which each file will generate an executable file after compilation.
Do not put a lot of code under this directory, the code is as simple as possible.
/internal
The application's encapsulated code, an application-private code is put into the /internal/myapp/
directory, multiple applications are common to common code, and put into /internal/common
directories like that.
/pkg
Some common code that can be used by other projects is placed under this directory
/vendor
Other third-party libraries that the project relies on, using glide
tools to manage dependencies
/api
protocol files, Swagger/thrift/protobuf
etc.
/web
Static files required by the Web service
/configs
Configuration file
/init
Service Start-Stop script
/scripts
Other scripts, compiling, installing, testing, analyzing, etc.
/build
Continuous Integration Catalog
Package configurations and scripts for Cloud (AMI), container (Docker), operating system (Deb, RPM, pkg) and so on are placed in the /build/package/
directory
/deployments
Deploy related configuration files and templates
/test
Other test catalogs, functional tests, performance tests, etc.
/docs
Design document
/tools
Common tools and scripts that can be referenced /internal
or /pkg
inside the library
/examples
Some examples of applications or common library use
/assets
Some other dependent static resources
Reprint Please specify source
This article link: http://hatlonely.github.io/20 ...