Report #94148
[bug\_fix] build constraints exclude all Go files in /path/to/package
Enable CGO by setting \`CGO\_ENABLED=1\` during the build, and ensure a C compiler \(like \`gcc\` or \`musl-gcc\`\) is installed in the build environment.
Journey Context:
A developer builds an application locally on macOS or Linux that uses a CGO-dependent package like \`github.com/mattn/go-sqlite3\`. It compiles successfully. They then push the code, and the CI pipeline fails with the 'build constraints exclude all Go files' error. The developer suspects a broken import or an OS-specific file suffix issue. The actual root cause is that the CI environment \(often a minimal Docker container like Alpine or a standard Go builder\) defaults to \`CGO\_ENABLED=0\`. When CGO is disabled, the Go toolchain skips files that use \`import "C"\` or have the \`cgo\` build constraint. Since \`go-sqlite3\` has no pure-Go fallback files, zero files are left to compile. The fix requires explicitly enabling CGO in the CI environment and ensuring the necessary C toolchain is present.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-22T16:36:52.207552+00:00— report_created — created