-
Notifications
You must be signed in to change notification settings - Fork 17.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
cmd/go: tidy behavior regarding ignore tag is hard to find #54993
Comments
I should be more clear: This is the output of
The detail about how |
`go mod tidy` will ignore files with the build constraint `ignore`. This is documented in https://go.dev/ref/mod#go-mod-tidy. While this URL in mentioned in the existing help text, the fact about the special handling of the `ignore` tag is significant enough to be mentioned explicitly in the help text. From the existing link it's not inmediately obvious that this special behavior exists. Take most of the relevant text from the online description and add it to the help text of `go mod tidy`. Fixes: golang#54993 Signed-off-by: Marcelo E. Magallon <marcelo.magallon@gmail.com>
Change https://go.dev/cl/430136 mentions this issue: |
The alternative fix is to change the help text in
because that is not true: https://github.com/golang/go/blob/master/src/cmd/go/internal/imports/build.go#L188 If that is preferred, I would still propose that the help text for |
cc @bcmills |
`go mod tidy` will ignore files with the build constraint `ignore`. This is documented in https://go.dev/ref/mod#go-mod-tidy. While this URL in mentioned in the existing help text, the fact about the special handling of the `ignore` tag is significant enough to be mentioned explicitly in the help text. From the existing link it's not inmediately obvious that this special behavior exists. Take most of the relevant text from the online description and add it to the help text of `go mod tidy`. Fixes: golang#54993 Signed-off-by: Marcelo E. Magallon <marcelo.magallon@gmail.com>
`go mod tidy` will ignore files with the build constraint `ignore`. This is documented in https://go.dev/ref/mod#go-mod-tidy. While this URL in mentioned in the existing help text, the fact about the special handling of the `ignore` tag is significant enough to be mentioned explicitly in the help text. From the existing link it's not inmediately obvious that this special behavior exists. Take most of the relevant text from the online description and add it to the help text of `go mod tidy`. Fixes: golang#54993 Signed-off-by: Marcelo E. Magallon <marcelo.magallon@gmail.com>
`go mod tidy` will ignore files with the build constraint `ignore`. This is documented in https://go.dev/ref/mod#go-mod-tidy. While this URL in mentioned in the existing help text, the fact about the special handling of the `ignore` tag is significant enough to be mentioned explicitly in the help text. From the existing link it's not inmediately obvious that this special behavior exists. Take most of the relevant text from the online description and add it to the help text of `go mod tidy`. Fixes: golang#54993 Signed-off-by: Marcelo E. Magallon <marcelo.magallon@gmail.com>
What operating system and processor architecture are you using (
go env
)?go env
OutputWhat did you do?
I was working with ruleguard, which recommends to use the
ignore
tag to exclude rules form the build.Quoting from https://github.com/quasilyte/go-ruleguard/blob/master/README.md?plain=1#L72
ruleguard fails to run because the package
github.com/quasilyte/go-ruleguard/dsl
is not listed in the main module's go.mod file and because of the way it works, it needs to have this package available.After running:
ruleguard works.
But after running
go mod tidy
, ruleguard fails again.Going over
go.mod
, the package is no longer listed.What did you expect to see?
The package github.com/quasilyte/go-ruleguard/dsl is still present in go.mod after running go mod tidy.
What did you see instead?
The package github.com/quasilyte/go-ruleguard/dsl is gone from go.mod after running go mod tidy.
It turns out the problem is that go mod tidy will handle the
ignore
tag in a different way, as mentioned in https://go.dev/ref/mod#go-mod-tidy, which is referenced from the output ofgo help mod tidy
:The detail about
ignore
is not minor, and it should be more readily available.The text was updated successfully, but these errors were encountered: