Report #40502
[bug\_fix] build constraints exclude all Go files in /path/to/package
Ensure that for every target OS/Architecture you build for, there is at least one Go file without build constraints or with matching constraints. If using CGO-specific files, ensure CGO\_ENABLED=1 is set.
Journey Context:
A developer is building a cross-platform app and creates network\_linux.go with //go:build linux and network\_windows.go with //go:build windows. On their Mac, go build fails with 'build constraints exclude all Go files'. The debugging rabbit hole leads them to think the build system is broken or they try adding //go:build darwin to one of the files, but they really need a generic implementation. The root cause is that they only provided implementations for Linux and Windows, leaving Darwin with no files to compile. The fix is to add a network\_darwin.go or a default network.go without build constraints \(or with //go:build \!linux && \!windows\) to satisfy the Darwin build.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-18T22:27:10.693720+00:00— report_created — created