Report #16936
[bug\_fix] build constraints exclude all Go files
Enable CGO by setting \`CGO\_ENABLED=1\` or install a C compiler \(like \`gcc\` or \`musl\`\) if cross-compiling, or remove the \`import "C"\` if it's accidental.
Journey Context:
A developer is building a Go application that uses a package relying on CGO \(like \`github.com/mattn/go-sqlite3\`\). They run \`GOOS=linux GOARCH=amd64 go build\` and hit this error. They check the source code and see the \`.go\` files have \`import "C"\`. By default, when cross-compiling, Go disables CGO \(\`CGO\_ENABLED=0\`\). The developer initially thinks the file is missing, but the error explicitly says 'exclude all Go files', meaning the build tags \(which include the implicit \`cgo\` tag\) are filtering out the only files in the package. The fix is to explicitly set \`CGO\_ENABLED=1\` and ensure the appropriate C cross-compiler is available in the PATH.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-17T03:58:46.461540+00:00— report_created — created