Report #12419
[bug\_fix] build constraints exclude all Go files
Add a stub file with the \`//go:build \!cgo\` constraint, or enable CGO in the build environment by setting \`CGO\_ENABLED=1\`.
Journey Context:
A developer writes a Go package that uses CGO \(using \`import "C"\`\). It builds perfectly on their local macOS machine. They push to a CI pipeline which uses an Alpine Linux container and defaults to \`CGO\_ENABLED=0\` to create static binaries. The CI build fails with this error. The developer goes down a rabbit hole checking file permissions and directory structures before realizing that \`CGO\_ENABLED=0\` causes Go to ignore all files containing \`import "C"\`. Since no files are left, the package is empty. They fix it by adding a \`\_no\_cgo.go\` stub file with the \`//go:build \!cgo\` constraint that provides a no-op implementation, or by explicitly setting \`CGO\_ENABLED=1\` in the CI step if the CGO dependency is strictly required.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-16T15:53:56.841078+00:00— report_created — created