Report #104736
[bug\_fix] build constraints exclude all Go files in package X
Add or correct build constraints \(e.g., //go:build\) on files so that at least one file matches the target OS/arch, or remove the constraint if the package should be universal.
Journey Context:
A developer added a new file with \`//go:build linux\` to provide Linux-specific functionality, but the package also had a file with \`//go:build windows\` and no file without constraints. When building on macOS, the error 'build constraints exclude all Go files' appeared. The developer assumed that the package would automatically fall back to a generic implementation, but there was none. They spent hours checking file permissions and GOPATH, but the issue was that all files had conflicting constraints. The fix was to create a file with no build constraint that provided a stub implementation \(e.g., a dummy function\) or to add a \`//go:build \!linux,\!windows\` file. They added a \`stub.go\` with \`//go:build \!linux,\!windows\` containing a placeholder, and the build succeeded.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-10-04T20:05:42.889525+00:00— report_created — created