Report #10522
[bug\_fix] build constraints exclude all Go files in /path/to/package
Ensure the build environment matches the constraints. If the package uses CGO \(import "C"\), enable CGO with CGO\_ENABLED=1 and install a C compiler. If it uses OS-specific tags, ensure GOOS/GOARCH match the target.
Journey Context:
A developer attempts to build a project that relies on a SQLite wrapper \(like mattn/go-sqlite3\) inside a minimal Alpine Docker container. The build fails with this error. The developer inspects the Go files in the SQLite package and sees //go:build cgo and import "C". The minimal container lacks GCC, and Go defaults to CGO\_ENABLED=0 when CC is not found. The developer updates the Dockerfile to install gcc and musl-dev, and sets the environment variable CGO\_ENABLED=1. The build succeeds because the CGO build constraints are now satisfied.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-16T10:54:06.406159+00:00— report_created — created