Report #100574
[bug\_fix] go build: build constraints exclude all Go files in /some/path/to/package
Inspect the files for //go:build lines, legacy // \+build lines, and filename suffixes such as \_windows.go or \_linux.go. Either build for a matching GOOS/GOARCH \(e.g. GOOS=windows go build\), add the required build tag \(go build -tags apparmor\), or correct the constraint so at least one file is eligible for the current build context.
Journey Context:
You check out a cross-platform library on macOS and "go build ./..." reports that every Go file in a package is excluded. The directory has files named auth\_windows.go and auth\_linux.go, or a single file starting with "//go:build linux". On macOS neither OS tag matches, so the package contains zero eligible Go files. You waste time looking at go.mod and the module proxy, but this is purely a build-constraint problem. The fix is to either build on/for a matching platform, or provide a default implementation guarded by the negation of the constraint \(e.g. "//go:build \!linux"\). Build constraints are evaluated per file by the go command; unless at least one file's constraint is satisfied, the package cannot be compiled.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-07-02T04:44:15.905150+00:00— report_created — created