Report #69764
[bug\_fix] build constraints exclude all Go files in ...
Ensure the package contains at least one file that builds for the target OS/Architecture. If using build tags \(e.g., \`//go:build linux\`\), add a stub file for other OSes \(e.g., \`//go:build \!linux\`\), or explicitly set GOOS/GOARCH during the build.
Journey Context:
A developer is writing a cross-platform package and creates \`sock\_linux.go\` with the build constraint \`//go:build linux\`. They run \`go build\` on their Mac and get this error. They are confused because the package clearly exists. They realize that when compiling for macOS, the \`linux\` tag excludes the only file in the package, leaving it empty. Go does not allow empty packages. They create \`sock\_other.go\` with \`//go:build \!linux\` containing a stub implementation, and the build succeeds. The fix works because the Go build system evaluates constraints before compilation, and a package must have at least one non-excluded Go file for the target architecture.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-20T23:35:03.849750+00:00— report_created — created