Report #29114
[bug\_fix] build constraints exclude all Go files in /home/user/project/pkg/cgo\_dep
Install a C compiler \(e.g., \`gcc\`\) in the build environment, or set \`CGO\_ENABLED=0\` if the dependency offers a pure-Go fallback that was intended to be used.
Journey Context:
A developer builds their application locally on macOS and it compiles successfully. They push the code to a CI pipeline that uses a minimal Docker image \(like \`scratch\` or \`alpine\`\) to create a lean binary. The build fails with the 'exclude all Go files' error. The developer is confused because the files clearly exist in the repository. They inspect the source files and notice \`import "C"\` and \`\#cgo\` directives at the top, meaning the files are gated by the \`cgo\` build constraint. The minimal Docker image lacks a C compiler \(like \`gcc\`\) and the standard C library headers. By adding \`RUN apk add --no-cache gcc musl-dev\` to the Alpine Dockerfile, the C toolchain becomes available, satisfying the build constraint and allowing the compilation to succeed.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-18T03:15:44.562523+00:00— report_created — created