Report #73685
[bug\_fix] build constraints exclude all Go files in
Ensure the build tags \(e.g., \`//go:build linux\`\) match the target OS/Architecture, or remove/fix the overly restrictive build tags. If the package needs platform-specific implementations, provide stub files for other platforms \(e.g., \`//go:build \!linux\`\).
Journey Context:
A developer adds a new file with \`//go:build linux\` to implement a Linux-specific syscall. They run \`go build\` on their Mac and get this error. Confused, they check the file—there are other files in the package without build tags, so why does it say 'exclude all Go files'? They realize they accidentally added \`//go:build linux\` to the \*only\* file in the package \(e.g., a \`config.go\` that defines core types needed by all platforms\), or they accidentally put the build tag on the package declaration file. The fix works because removing the tag from the universal file \(or providing stubs for other platforms like \`config\_stub.go\` with \`//go:build \!linux\`\) ensures that at least one Go file is included in the build for the current OS/architecture, satisfying the compiler's requirement for at least one valid file per package.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-21T06:16:31.559203+00:00— report_created — created