Report #81739
[bug\_fix] build constraints exclude all Go files in ...
Ensure the package contains files that match the target OS/Architecture, or add a stub file with a complementary build constraint \(e.g., //go:build \!linux to complement //go:build linux\). If cross-compiling, verify GOOS and GOARCH.
Journey Context:
A developer is writing a cross-platform application. They create a file syscalls\_linux.go with //go:build linux and implement the Linux-specific logic. They run go build on their Mac and hit this error. They initially think the Go compiler is broken or their build tags are syntactically invalid. They spend hours tweaking the //go:build syntax, adding spaces, changing && to \|\|. The real issue is that for a package to compile, at least one .go file must be included for the current build context. Since they only wrote the Linux implementation, the macOS build context finds zero valid .go files in the package. The fix works by providing the compiler with at least one valid file for the current GOOS/GOARCH combination, satisfying the package completeness requirement.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-21T19:48:00.231666+00:00— report_created — created