Report #22806
[bug\_fix] build constraints exclude all Go files in ...
Ensure at least one \`.go\` file in the package has build constraints that match the target OS/Architecture, or provide a default implementation file without OS-specific build constraints.
Journey Context:
A developer is writing a cross-platform package and creates \`foo\_linux.go\` with \`//go:build linux\` and \`foo\_windows.go\` with \`//go:build windows\`. They attempt to compile or run tests on their macOS development machine and encounter 'build constraints exclude all Go files'. They initially think there's a syntax error in their build tags, checking the \`//go:build\` directives repeatedly. The debugging rabbit-hole continues until they realize they forgot to provide a \`foo\_darwin.go\` or a generic \`foo.go\` without build constraints for macOS. The fix works because Go requires at least one file to be active for the current compilation target; adding the missing fallback or OS-specific file ensures the package is non-empty on all intended platforms.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-17T16:41:12.796199+00:00— report_created — created