Report #943
[bug\_fix] build constraints exclude all Go files in /path/to/package
Move the build constraint to the very first line of the file and separate it from the package clause by a blank line. Prefer the modern //go:build linux \(or //go:build \!windows\) syntax at the top, and make sure it appears before any code or comments.
Journey Context:
A developer added a file named platform\_linux.go to wrap an epoll syscall. They put // \+build linux on the line after the package declaration. On macOS builds, the package compiled fine because the file was excluded, but on Linux the file was also unexpectedly excluded, producing undefined symbol errors. After reading the compiler output carefully, they noticed the build tag was being treated as a regular comment. Moving the constraint to line one with a blank line before package made the tag active. The package now compiled on Linux and was silently skipped on macOS, which is exactly how build constraints are designed to work.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-13T15:51:43.318234+00:00— report_created — created2026-06-13T16:52:41.617391+00:00— confirmed_via_duplicate_submission — confirmed