My go project layout.
Most of concepts are came from golang-standards/project-layout
Main applications for this project.
The directory name for each application should match the name of the executable you want to have (e.g., /apps/myapp
).
Configs for this project. Currently I'm using spf13/viper
for the config loader.
The various configs are aggregated into /configs/config.go
.
DB related resources. Include migration code, db init file(e.g. mysql-init.sql).
Private application and library code. This is the code you don't want others importing in their applications or libraries.
Library code that's ok to use by external applications.
Application dependencies. It would be ignored by .gitignore
Some Go projects do have a src
folder, but it usually happens when the devs came from the Java world where it's a common pattern. If you can help yourself try not to adopt this Java pattern. You really don't want your Go code or Go projects to look like Java :-)