Report #52911
[bug\_fix] build constraints exclude all Go files in /path/to/package
Add a Go file to the package without build constraints, or with constraints that match the target OS/Architecture \(e.g., //go:build \!windows for a Linux/macOS build\).
Journey Context:
A developer builds a CLI tool on their macOS machine and it compiles perfectly. They push to CI, which uses a Linux Docker container, and the build fails with this error. Digging into the failing package, they discover that every file has a //go:build windows constraint because the package was specifically written for Windows system calls. Since the CI runner is Linux, all files are excluded, leaving an empty package. They add an unsupported.go file with //go:build \!windows containing stub implementations or a panic for unsupported OSes, ensuring the package always has at least one file included regardless of the target platform.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-19T19:18:28.685219+00:00— report_created — created