Join GitHub today
GitHub is home to over 31 million developers working together to host and review code, manage projects, and build software together.Sign up
cmd/vet: +build comment error is confusingly worded #31410
Please answer these questions before submitting your issue. Thanks!
What did you do?
Hello up there. I was updating my tracing/xruntime package for Go1.12 and hit test error:
The error here complains about
---- 8< ---- (
#include "textflag.h" // +build amd64 amd64p // func getg() *g TEXT ·getg(SB),NOSPLIT,$0-8 MOVQ (TLS), R14 MOVQ R14, ret+0(FP) RET
It was working with Go1.11 and previous releases.
What did you expect to see?
Build and test succeed; test pass, as with e.g. Go1.11:
What did you see instead?
The error could be improved (obviously there is no package clause), but it is correct to be complaining. The
A more appropriate error would be
./runtime_g_amd64.s:3:1: +build comment must appear before first non-comment source line
and the "blank line" should be dropped in this instance. When the blank line is relevant the message should be
./runtime_g_amd64.s:3:1: blank line must separate +build comment from first non-comment source line