Report #97082
[bug\_fix] build constraints exclude all Go files in /path/to/package
Ensure the build environment satisfies the package's \`//go:build\` constraints. If the package uses CGO, install a C compiler \(like \`gcc\`\) and set \`CGO\_ENABLED=1\`. Alternatively, replace the CGO-dependent package with a pure-Go alternative.
Journey Context:
A developer builds a web application locally on macOS and it works perfectly. They push it to a Docker container based on Alpine Linux to create a lean production image, and the build crashes with 'build constraints exclude all Go files'. They inspect the failing package and realize it's a SQLite driver that relies on CGO \(\`import "C"\`\). The Alpine Docker image lacks \`gcc\`, and the \`CGO\_ENABLED=0\` default in some minimal build environments excludes all \`.go\` files containing CGO code. They debug by checking the \`//go:build\` tags and realize the toolchain is skipping every file in the package. They fix it by adding \`RUN apk add --no-cache gcc musl-dev\` to their Dockerfile and setting \`ENV CGO\_ENABLED=1\`, allowing the CGO files to be included in the build.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-22T21:32:01.918371+00:00— report_created — created