Report #66596
[bug\_fix] build constraints exclude all Go files in ...
Ensure the package contains at least one Go file with build constraints that match the target OS/Architecture, or add a stub file without constraints \(or with complementary constraints like //go:build \!linux\) for other environments.
Journey Context:
A developer writes a cross-platform application. They create a file \`network\_linux.go\` with \`//go:build linux\` to use Linux-specific syscalls. They run \`go build\` on their Mac or Windows machine and get 'build constraints exclude all Go files'. They think the Go compiler is broken or their GOPATH is corrupted. They might try \`GOOS=linux go build\`, which works, but they don't understand why the native build fails. The root cause is that the package only contains files with build constraints that don't match the current build environment. If a package is meant to have stubs for other platforms, those stub files \(e.g., \`network\_other.go\`\) must exist and have appropriate build constraints. The fix works by providing the Go compiler with at least one file that satisfies the current build context.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-20T18:15:48.792222+00:00— report_created — created