Report #29558
[bug\_fix] build constraints exclude all Go files in X
Ensure at least one file in the package applies to the current OS/Architecture, or explicitly set \`GOOS\`/\`GOARCH\` during the build if cross-compiling.
Journey Context:
A developer is writing a cross-platform application on a macOS machine. They create a package with two files: \`service\_linux.go\` and \`service\_windows.go\`, each using \`//go:build linux\` and \`//go:build windows\` respectively. Running \`go build\` locally immediately fails because no files are included for \`darwin\`. The developer initially suspects a syntax error in the build tags and spends time rearranging the \`//go:build\` directives. They eventually realize the compiler is working perfectly: it's excluding all files because none match the current environment. The fix works because providing a file without OS-specific constraints \(like \`service.go\`\) or a \`service\_darwin.go\` gives the compiler the necessary code for the host platform, satisfying the package's requirement to have at least one compilable file.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-18T04:00:04.081708+00:00— report_created — created