Suddenly go build doesn't respect '// +build ignore' flag #28687
Labels
FrozenDueToAge
WaitingForInfo
Issue is not actionable because of missing required information, which needs to be provided.
What version of Go are you using (
go version
)?What operating system and processor architecture are you using (
go env
)?go env
OutputWhat did you do?
Just use the command
env CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -o attacker main.go
to build one of my single package to executable binary.But since I don't want to include this package in my production release, so i use the
// +build ignore
to ignore it, only when i need to run above build command i remove the// +build ignore
flag.Previously the
// +build ignore
was working as expected, i mean if i run above command with it i will run into error that "the source was ignored.. bla bla", if i want to build it then i need to remove the// +build ignore
, but now with the// +build ignore
there, i still can build it!!!, totally cannot recall what was changed to cause this.What did you expect to see?
With the
// +build ignore
i should not able to build the source.What did you see instead?
Even with the
// +build ignore
there i am still able not build the source and roll out the executable binary!The text was updated successfully, but these errors were encountered: