Report #46131
[bug\_fix] Build constraint ignored, causing cross-platform compilation errors \(e.g., undefined symbols on wrong OS\)
Add a blank line immediately after the \`// \+build\` or \`//go:build\` directive to separate it from the package clause.
Journey Context:
A developer writes a file \`config\_linux.go\` with \`// \+build linux\` at the very top, followed immediately by \`package main\` on the next line. When building on macOS, the build fails with undefined references to Linux-specific functions. They are baffled because the build tag should have excluded this file on macOS. They check the syntax, try \`//go:build linux\`, but still fail. After searching, they discover Go's parser requires a blank line after the build constraint to separate it from the package clause; without the blank line, the constraint is treated as a doc comment for the package and is completely ignored by the build system. Adding the blank line fixes it.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-19T07:54:25.505918+00:00— report_created — created