-
Notifications
You must be signed in to change notification settings - Fork 18k
cmd/go: go list should default to not modify go.mod and not exit non-zero when skipping go.mod update #41328
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
Comments
I understand the second proposed change is potentially more controversial, but the first is hopefully reasonable. |
|
Defaulting to |
Since Russ wrote #40728, I'm hopeful this will be fixed in 1.16. I still did analysis as this means the situation won't be better for another 6 months. None of the flag combination helps, they all misbehave in a way or another on go1.15.2. So even if the other issue is fixed, there should be better flag coherency in The following commands were run within fuchsia.git/tools:
Summary
None of the behavior is satisfactory. Raw dataWithout flag:
With -e only:
Wth -mod=readonly only:
Both -e -mod=readonly:
|
@maruel, if you want fine-grained control over the outputs of |
Also note that the |
@maruel, can you try a |
|
Ok. So what changes to the In general We can reasonably make We could perhaps allow |
Important note: go.sum is not tracked by git; I added it to .gitignore since we use a meta-checkout tool and use replace statements. We use replace statements to use the local versions: https://fuchsia.googlesource.com/fuchsia/+/master/tools/go.mod That said the only thing we want is that I don't think -e should be used. I think the fix should be that -mod=readonly should not complain if a newer minor version is available. |
This has nothing to do with whether a newer minor version is available. (The point of Go Modules is to provide reproducibility, not recency: I have a guess: you say you “use a meta-checkout tool and use replace statements”. Does the meta-checkout tool invoke Removing the
That is: So the easy fix here is to check in a |
Our meta checkout tool does not invoke any go tool, since we build the Go toolchain ourselves; Fuchsia support hasn't been upstreamed yet. Will close, my expectation for now is that we'll stay in a non optimal state for the foreseeable future. |
What version of Go are you using (
go version
)?go 1.15.2
What operating system and processor architecture are you using (
go env
)?debian derived with GO111MODULE="on"
What did you do?
$ go list
inside a directory containing a go.mod that refers to packages that have known newer versions available.
What did you expect to see?
A naive view would be that
go list
is a pure read-only operation. Seeing other go list related feature requests on GitHub, I realize this is not a shared expectation.What did you see instead?
Using
go list
causes it to touch ./go.mod.Using
go list -mod=readonly
stops touching ./go.mod but:Workaround
Use the flag
-mod=readonly
at each invocation but:go help list
norgo list -help
document this flag, which hinders the UX.go help modules
does butgo help modules | wc -w
is more than 3200 words.It can be "permanently" set as the default via:
That's even less discoverable though, as one has to know about GOFLAGS and it has whole system impact.
Proposed change
My take would be:
go list -mod=readonly
exit 0 when it skips updating go.mod and not print an error message.go list
default to-mod=readonly
since it's a querying function.More context for googlers: fxb/59330
The text was updated successfully, but these errors were encountered: