Report #84978
[bug\_fix] build constraints exclude all Go files in ...
Add a stub file with a complementary build constraint \(like //go:build \!linux if the existing file is //go:build linux\) or ensure the package is only imported on the target platform using platform-specific imports.
Journey Context:
A developer is building a Go application on macOS \(darwin\) that uses a package containing a file with //go:build linux. If this package is imported unconditionally by the main application, the Go compiler attempts to compile it on macOS, finds zero files that satisfy the build constraints for darwin, and fails. The developer might try to add empty files or use // \+build ignore, which leads to other issues. The root cause is that a package must have at least one file that compiles on the current target OS/architecture. The fix is to provide a stub implementation for non-Linux platforms \(e.g., //go:build \!linux\) so the package compiles everywhere, or use platform-specific import paths if the dependency is only needed on Linux.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-22T01:13:13.456176+00:00— report_created — created