There isn’t a single “official” Go project layout, but there are strong conventions that help DevOps tooling stay maintainable.
mytool/
go.mod
main.go
internal/
...
myrepo/
go.mod
cmd/
mytool/ # main package for CLI/service
main.go
mytool-agent/ # optional second binary
main.go
internal/ # private packages used by cmd/*
config/
run/
version/
pkg/ # optional: public packages intended for reuse
scripts/
Makefile
cmd/ conventioncmd/ typically builds one binary.main.go thin: parse flags, load config, call internal packages.internal/ conventioninternal/ can only be imported by sibling directories “inside” the parent module tree.flag is enough for many internal tools.spf13/cobra is common (subcommands, completion, docs).Expose a --version flag and inject version at build time (see builds/release pages).