Organising a Go module
Organizing a Go module - The Go Programming Language
A common question developers new to Go have is “How do I organize my Go
project?”, in terms of the layout of files and folders. The goal of this
document is to provide some guidelines that will help answer this question. To
make the most of this document, make sure you’re familiar with the basics of Go
modules by reading the tutorial and
managing module source.
https://go.dev/doc/modules/layout#
For a server its typically
project-root-directory/
go.mod
internal/
auth/
...
metrics/
...
model/
...
cmd/
api-server/
main.go
metrics-analyzer/
main.go
...
... the project's other directories with non-Go code