Report #51109
[bug\_fix] build constraints exclude all Go files in ...
Ensure the package contains at least one Go file that applies to the current GOOS/GOARCH, or conditionally import the package only when the build constraints are satisfied.
Journey Context:
A developer is building a cross-platform CLI application. They create platform-specific implementations using build tags like \`//go:build linux\` and \`//go:build windows\`. When they attempt to build or test on their macOS machine, the compiler throws an error that build constraints exclude all files in the package. They initially suspect a broken Go installation or a corrupted cache. After clearing the module cache, the error persists. They review their file structure and realize they forgot to create a \`config\_darwin.go\` \(or a default \`config.go\` without tags\) for macOS. Since Go requires at least one valid file for an imported package on the target OS/Arch, adding a file with the \`//go:build darwin\` tag \(or removing the unconditional import of the platform-specific package\) resolves the build.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-19T16:16:37.183944+00:00— report_created — created