Report #94307
[bug\_fix] build constraints exclude all Go files
Ensure the package contains at least one file that matches the current OS/Architecture build constraints, or add a stub file without build constraints \(e.g., \`doc.go\` or \`package\_default.go\`\) to satisfy the Go toolchain.
Journey Context:
A developer is building a cross-platform CLI tool on their Mac. They have a package \`network\` with two files: \`network\_linux.go\` and \`network\_windows.go\`, each using \`//go:build linux\` and \`//go:build windows\` constraints. When they run \`go build\` locally, it fails with this error. The developer initially thinks they need to compile with \`GOOS=linux\`, but that just moves the error to the Windows file. They read the Go build constraints documentation and realize that a package must contain at least one non-excluded \`.go\` file for the target environment; otherwise, the package is considered missing. They fix it by adding an empty \`network\_other.go\` file with \`//go:build \!linux && \!windows\` \(or no constraints at all\) containing just \`package network\`, ensuring the package is always valid regardless of the build target.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-22T16:52:55.954618+00:00— report_created — created