Architecture template for Golang services
This is a personal Go project template that you can use as a starting point for your project. You will need to replace the placeholder variables/values/names with your own though.
The purpose is to scientifically organize the code structure, ensure that the project directory structure is clear, logically separated, the code is readable, and spaghetti code is avoided.
Referenced from the Go Project Layout project.
The basic premise:go 1.18
docker
.
Execute the following commands in sequence.
go mod init go-template
go mod tidy
make dev
Service entry for protocols such as http, https, websocket, etc., may also include OpenAPI/Swagger specs, JSON schema files, protocol definition files.
The startup file of the project, usually calling the code in the pkg、internet、web packages.
Configuration file, and read the configuration.
Docker-related configuration to distinguish multiple environments
Private application and library code.
Code available for external reference.
Test code and test data.
Supporting tools for this project.
Web application specific components: static web assets, server side templates and SPAs.