Report #3881
[bug\_fix] build constraints exclude all Go files in path
Add the matching file suffix \(e.g., \`\_linux.go\`, \`\_amd64.go\`\) or a build-tag comment \(\`//go:build linux\`\) so the file is selected for the target GOOS/GOARCH. If the file should compile everywhere, remove the misplaced build tag or suffix. Verify with \`GOOS=linux GOARCH=amd64 go build ./...\` on the platform that will run the build.
Journey Context:
A service ran perfectly on a developer's Apple Silicon Mac but failed in CI with \`build constraints exclude all Go files in path internal/platform\`. The package contained only \`syscalls\_linux.go\` and \`syscalls\_darwin.go\`. The developer initially thought Go was broken because both files were clearly present, but \`go list -f '\{\{.GoFiles\}\}'\` on the Linux runner showed neither file was selected. They eventually noticed the \`\_linux\` file had been accidentally copied with a leading space in its name and an invisible \`//go:build \!linux\` tag added during a refactor. Renaming the file and correcting the build tag to \`//go:build linux\` restored the Linux implementation. The root cause was that Go silently ignores files whose suffixes or build tags do not match the active target, a behavior that is easy to miss when a local build uses a different OS.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-15T18:27:21.403031+00:00— report_created — created