Go: package app/cmd: no Go files in /app/cmd / build constraints exclude all Go files
The directory you asked Go to build contains no buildable .go files.
no Go files inbuild constraints exclude all Go files ingo: warning: "./..." matched no packagesno non-test Go files inpackage app/cmd: no Go files in /app/cmd Meaning
Build the right package path (go build ./cmd/server), make sure files have the .go extension and are not excluded by build tags or _GOOS/_GOARCH suffixes, and that _test.go files aren't the only ones. In Docker verify the files were copied.
Common causes
- Wrong directory (no .go files at that level)
- Only _test.go files present
- Build tags / filename suffix excluding all files for this OS/arch
- Files not copied into the Docker context
- Package in a subfolder
⚡ Quick fix
- Point to the actual main package:
go build ./cmd/app - Check
//go:buildlines and_linux.gostyle suffixes - Verify
.dockerignoreand COPY steps
Detailed fix by platform
Go
go list ./...shows all buildable packages
How to diagnose
- Path — Contains .go files?
- Tags — Exclude them?
- Docker — Files present?
🔧 Still not fixed?
Many errors look alike. If the steps above didn’t solve it, one of these is probably what you’re facing:
Similar errors
- assignment mismatch: 1 variable but f returns 2 values Go: assignment mismatch: 1 variable but os.Open returns 2 values
- cannot assign to struct field m[k].f in map Go: cannot assign to struct field users["bob"].Age in map
- cgo: C compiler gcc not found Go: cgo: C compiler "gcc" not found: exec: "gcc": executable file not found in $PATH
Most viewed in Go
Other ways to find it
Where this error sits
Origin: Application & API. Errors that are often confused with or caused by this one (click to open):
🧠 Still stuck? Analyze your error
Paste the full message, response headers or stack trace — we'll detect the platform and point to the most likely cause.
💬 What worked for others
No tips yet — did something else fix this for you?
Share what worked for you
Tips are checked by an editor before they appear. Links are removed.
Report a correction or suggest an improvement
Last updated 4 Nov 2026