Report #97685
[bug\_fix] build constraints exclude all Go files in /path/to/package
Check the file names and build tags. Ensure at least one .go file in the package directory has a matching build constraint \(e.g., \`//go:build linux\` or \`// \+build linux\`\). If the package targets a specific OS/arch, ensure the GOOS/GOARCH environment variables are set appropriately. For example, a file named \`foo\_windows.go\` will only compile on Windows. Rename files or adjust build tags to match the target platform.
Journey Context:
A developer working on macOS tried to \`go build\` a package that only contained files with \`//go:build windows\` constraints. The compiler gave 'build constraints exclude all Go files'. The developer thought the package was broken and spent time checking go.mod and module paths. The root cause was that the package was designed for Windows only and the developer's environment was macOS. The fix was to either cross-compile with \`GOOS=windows go build\` or add a stub file for other OSes. In another case, a developer had misspelled the build tag as \`//go:build linx\` which excluded the file from all platforms.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-25T15:51:25.934679+00:00— report_created — created