ignore is t a reserved word, but it’s used in lots of example files as a “don’t build this, period” marker. I’m not sure what to do here other than saying “don’t use ignore as the name of a build tag”
ignore is t a reserved word, but it’s used in lots of example files as a “don’t build this, period” marker. I’m not sure what to do here other than saying “don’t use ignore as the name of a build tag”
Perhaps the go command should explicitly error out if you pass -tags=ignore? That's certainly less confusing.
Worth noting that the ignore build tag is already treated in a special way by Go tools, such as go mod tidy ignoring it.
It seems reasonable to me to have -tags=ignore error with a helpful message; all use cases of // +build ignore I've seen involve running the file directly to ignore build constraints, like go run ignored.go. And the standard library breaks with that build tag, anyway.
mvdan
changed the title
Ignore build flag causes cyclical dependency errors in the standard library
cmd/go: -tags=ignore makes the standard library fail to build
Jun 15, 2021
I like the error message idea @mvdan. Also, @tmthrgd do you have a reference to any docs that mention this? I was looking but I couldn't find this information.
@mvdan, I think we should continue to allow go list -tags=ignored to list these files, since that works in a lot of cases today (especially with the -e flag). I agree that we could improve the error message from commands that actually build dependencies, though.
bcmills
changed the title
cmd/go: -tags=ignore makes the standard library fail to build
cmd/go: emit a clearer error message when building with -tags=ignore
Jun 15, 2021
What version of Go are you using (
go version
)?Does this issue reproduce with the latest release?
Yes
What operating system and processor architecture are you using (
go env
)?go env
OutputWhat did you do?
//+build ignore
build flag to the top of a test filego test -v --tags=ignore ../.
What did you expect to see?
My test output
What did you see instead?
go test -v --tags=ignore ../.
OutputThe text was updated successfully, but these errors were encountered: