Does this issue reproduce with the latest release?
What did you do?
I were working with a module using command go mod; i expected that i can update dependency with commands: go mod update -u <dependency> go mod update <dependency>@commit
What did you expect to see?
I expected for this to work.
I expected for this to show in go help mod:
go mod <command> [arguments]
The commands are:
download download modules to local cache
edit edit go.mod from tools or scripts
graph print module requirement graph
init initialize new module in current directory
tidy add missing and remove unused modules
vendor make vendored copy of dependencies
verify verify dependencies have expected content
why explain why packages or modules are needed
What did you see instead?
After asking a question regarding this topic on golang slack channel i received help from Tim Heckman that stated:
yeah, the choice was made to keep it as go get so all the existing Gophers wouldn't need to relearn the command(s).
yeah, that was kept for historical purposes... that was how dependencies have always been gotten.
He nicely explained to me that i have to use:
go get <dependency>@commit
go get -u <dependency>
Which for me is confusing - i expected that subcommand to be related to go mod but - it's not in the help of that command - while it's clearly related to modules.
The text was updated successfully, but these errors were encountered:
changed the title
subcommands related to "go mod" are not categorized under its "go help mod"Mar 2, 2021
Are we actually suggesting that go mod should gain a command to update modules? The last comments mention that, and @bcmills added the NeedsFix label. But the Documentation label is also present, which tells me we haven't decided to add a command yet.
In terms of docs, I do think go get is already mentioned pretty well:
$ go help mod
Go mod provides access to operations on modules.
Note that support for modules is built into all the go commands,
not just 'go mod'. For example, day-to-day adding, removing, upgrading,
and downgrading of dependencies should be done using 'go get'.
See 'go help modules' for an overview of module functionality.
go help modules doesn't directly talk about go get, but it points to a few places that do mention it pretty often.
If you think the docs aren't clear enough, how do you suggest we improve them?
It's understandable that you expected go mod update to exist, but if you run go help mod just like the error from go mod update tells you, you'll be pointed at go get straight away.
Also, in terms of "just update all dependencies", see #28424.