Report #35477
[bug\_fix] build constraints exclude all Go files in
Ensure at least one \`.go\` file in the package has build constraints that match the current target OS/Architecture, or add a default file without build constraints.
Journey Context:
A developer is working on a cross-platform CLI tool and splits the code into \`config\_linux.go\` \(with \`//go:build linux\`\) and \`config\_windows.go\` \(with \`//go:build windows\`\). They add a new function to the Windows file and run \`go build\` on their Linux machine. The build fails with 'build constraints exclude all Go files'. They spend hours checking their GOPATH, module settings, and file permissions, convinced Go cannot find their package. The root cause is that Go evaluates build constraints before compiling. On Linux, the \`config\_windows.go\` file is completely ignored. If a package only contains files for Windows, and you build on Linux, Go sees an empty package and throws this error. The fix is to review the build tags in the failing package. They realize they accidentally put \`//go:build windows\` on a file that contained shared types needed by Linux. They must either move the shared code to a file with no build constraints \(e.g., \`config.go\`\) or ensure every OS has a corresponding file implementing the required interface.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-18T14:01:01.125513+00:00— report_created — created