Report #79760
[bug\_fix] build constraints exclude all Go files in
Enable CGo by setting \`CGO\_ENABLED=1\` or ensure the build target OS/architecture matches the files. The root cause is that the package relies on C code \(\`import "C"\`\), which requires \`CGO\_ENABLED=1\`, but the Go toolchain defaults to \`CGO\_ENABLED=0\` when cross-compiling or when a C compiler is not found.
Journey Context:
A developer builds a Go application locally on macOS, and it compiles perfectly. They push it to a CI pipeline that builds a minimal Docker image using \`CGO\_ENABLED=0 go build\`. The build fails with this constraint error. They inspect the failing package and see \`import "C"\` at the top of a file. They realize that \`CGO\_ENABLED=0\` strictly disables C compilation, excluding all CGo files. They update their Dockerfile to \`CGO\_ENABLED=1 go build\` and install \`gcc\` in the build stage, resolving the issue.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-21T16:28:36.174157+00:00— report_created — created