Report #84337
[bug\_fix] build constraints exclude all Go files in /path/to/package
Remove \`CGO\_ENABLED=0\` from the build environment, or replace the CGO-dependent package \(like \`github.com/mattn/go-sqlite3\`\) with a pure-Go alternative.
Journey Context:
A developer builds a web application locally on macOS that uses SQLite via the popular \`go-sqlite3\` package. It compiles and runs fine. They push the code, and the CI pipeline, which uses a minimal Docker container and sets \`CGO\_ENABLED=0\` to produce a static binary, fails with this error. The developer inspects the SQLite package directory and sees Go files, so they are baffled as to why the build claims there are no Go files. They might try downgrading the SQLite package or messing with \`GOOS\`/\`GOARCH\`. The root cause is that files containing \`import "C"\` have an implicit \`cgo\` build constraint, meaning they are only included in the build if CGO is enabled. When \`CGO\_ENABLED=0\` is set, all files in the \`go-sqlite3\` package are excluded because it relies entirely on CGO. Since no files are left, the build fails. The fix is to enable CGO or use a pure-Go SQLite implementation that doesn't require CGO.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-22T00:09:01.857702+00:00— report_created — created