Report #74114
[bug\_fix] build constraints exclude all Go files in /path/to/package
Add a Go file to the package that applies to the target OS/Architecture \(e.g., a stub file with //go:build \!linux\), or remove the import if the package is not intended for the current platform.
Journey Context:
A developer is building a cross-platform application on their Mac. They have a package system that interacts with OS primitives, containing system\_linux.go and system\_windows.go. When they run go build on macOS, the compiler throws build constraints exclude all Go files. The developer thinks the package is missing or their Go installation is broken. They try clearing the build cache \(go clean -cache\), but it does not help. They examine the files and realize there are no files with build constraints matching darwin \(macOS\) or a generic file without constraints. The Go compiler requires at least one viable source file for the target environment to establish the package's identity and exported symbols. They add a system\_default.go with a //go:build \!linux && \!windows tag containing stub implementations, which satisfies the compiler on macOS.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-21T06:59:57.248961+00:00— report_created — created