This is a basic layout for Go application projects. It represents the most common directory structure with a number of small enhancements along with several supporting directories common to any real world application.
Clone the repository, keep what you need and delete everything else!
## Go Directories
*`/cmd`
Main applications for this project.
The directory name for each application should match the name of the executable you want to have (e.g., `/cmd/myapp`).
Don't put a lot of code in the application directory unless you think that code can be imported and used in other projects. If this is the case then the code should live in the `/pkg` directory.
It's common to have a small main function that imports and invokes the code from the `/internal` and `/pkg` directories.
*`/internal`
Private application and library code.
Put your actual application code in the `/internal/app` directory (e.g., `/internal/app/myapp`) and the code shared by those apps in the `/internal/pkg` directory (e.g., `/internal/pkg/myprivlib`).
*`/pkg`
Library code that's safe to use by external applications (e.g., `/pkg/mypubliclib`).
Other projects will import these libraries expecting them to work, so think twice before you put something here :-)
*`/vendor`
Application dependencies (managed manually or by your favorite dependency management tool).
Don't commit your application dependencies if you are building a library.