Report #36753
[bug\_fix] build constraints exclude all Go files in /path/to/package
Ensure the package contains at least one file with build constraints that match the target OS/Architecture, or add a default file without build constraints. The root cause is that every \`.go\` file in the directory has a \`//go:build\` directive \(like \`//go:build linux\`\) that evaluates to false for the current build environment, leaving the package completely empty for the compiler.
Journey Context:
A developer writes a package containing OS-specific implementations, putting \`//go:build linux\` at the top of all files. They attempt to compile the project on their macOS workstation and are hit with this error. They check the directory, confirming the files exist, and wonder if their Go installation is broken. After reading the error closely, they realize 'build constraints' refers to the build tags. They either add a \`\_default.go\` file without build tags for shared logic, or they use \`GOOS=linux go build\` to cross-compile for the intended target, unblocking the build.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-18T16:10:16.512551+00:00— report_created — created