Use a flat structure with cmd/ for apps, internal/ for private code, and pkg/ for public libraries to follow Go community standards.
There is no single mandated layout; the community standard is a flat structure with cmd/ for executables, internal/ for private packages, and pkg/ for public libraries. Place your main application entry point in cmd/myapp/main.go and your shared internal logic in internal/pkg/ to enforce visibility rules.
myproject/
go.mod
cmd/
myapp/
main.go
internal/
pkg/
logic.go
pkg/
public/
api.go
Think of this layout as a house with locked rooms. You put your main program in the front yard (cmd) so it can run, your private tools in the locked basement (internal) so only your house can use them, and your public tools in the garage (pkg) so neighbors can borrow them. This keeps your code organized and prevents outside projects from accidentally depending on your private logic.