Report #93121
[bug\_fix] build constraints exclude all Go files in ...
Ensure the package contains at least one file with build tags that match the target OS/Architecture, or remove the restrictive \`//go:build\` directives. If using cross-platform implementations, create a stub or default implementation file with \`//go:build \!\`.
Journey Context:
A developer is building a cross-platform application and splits OS-specific code using build tags like \`//go:build linux\` on a file containing a required struct implementation. When they run \`go build\` on their macOS machine, the compiler throws 'build constraints exclude all Go files'. They spend hours checking their GOPATH, clearing the build cache, and reinstalling Go, convinced the compiler is broken. Finally, they realize the interface has no implementation for \`darwin\` because they forgot to create the counterpart file with \`//go:build darwin\` or a default file with \`//go:build \!linux\`. The fix works because Go needs at least one valid source file for the target architecture to compile the package.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-22T14:53:31.351529+00:00— report_created — created