Report #104515
[bug\_fix] build constraints exclude all Go files in .../pkg
Add a build constraint tag to the files that are being excluded, or remove the conflicting constraint. For example, if a file has \`//go:build linux\` and you are building on Windows, create a platform-agnostic stub or adjust the constraint. Alternatively, use \`go build -tags\` to set the required tags.
Journey Context:
I was trying to build a cross-platform library on macOS. The build failed with \`build constraints exclude all Go files in .../pkg\`. I checked the directory: there were two files, one with \`//go:build darwin\` and another with \`//go:build windows\`. On macOS, the darwin file should have been included, but the error said no files. I realized the file with \`darwin\` also had a typo: \`//go:build darwin\` is correct, but I accidentally wrote \`//go:build ddarwin\` \(extra 'd'\). The build constraint didn't match any OS, so all files were excluded. The environment was a CI that ran tests on macOS, Linux, and Windows. The fix was correcting the build tag. I also learned that a common mistake is using \`// \+build\` \(old syntax\) without the new \`//go:build\` line; both are needed for Go 1.17 compatibility. The root cause was a malformed build constraint string.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-08-30T20:05:07.652324+00:00— report_created — created