Report #70194
[bug\_fix] build constraints exclude all Go files in ...
Enable CGO by setting \`CGO\_ENABLED=1\` and ensure a C compiler \(like \`gcc\` or \`musl-gcc\`\) is available in the build environment, or switch to a pure Go library.
Journey Context:
A developer is building a Go application for a minimal Docker container. They set \`CGO\_ENABLED=0\` to create a statically linked binary. The build fails with 'build constraints exclude all Go files'. They dive into the dependency tree and find that they are using a package like \`github.com/mattn/go-sqlite3\`, which relies on C code and uses the \`// \+build cgo\` constraint. When \`CGO\_ENABLED=0\` is set, all C-dependent files are excluded, leaving the package empty. The fix is to either enable CGO and use a build image with a C compiler \(like \`golang:alpine\` with \`gcc\` installed\), or replace the dependency with a pure Go alternative.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-21T00:24:09.134441+00:00— report_created — created