Skip to content
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: mention go get in go help mod #44726

Open
bukowa opened this issue Mar 2, 2021 · 4 comments
Open

cmd/go: mention go get in go help mod #44726

bukowa opened this issue Mar 2, 2021 · 4 comments
Labels
Documentation GoCommand help wanted NeedsFix
Milestone

Comments

@bukowa
Copy link

@bukowa bukowa commented Mar 2, 2021

What version of Go are you using (go version)?

$ go version
go version go1.16

Does this issue reproduce with the latest release?

Yes

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:

Usage:

        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.

@bukowa bukowa changed the title subcommands related to "go mod" are not categorized under its "go help mod" subcommands related to "go mod" are not categorized under its "go help mod" ("go get") Mar 2, 2021
@go101
Copy link

@go101 go101 commented Mar 2, 2021

Do you mean to use go mod update to depreciate go get? Not a bad idea IMO.

@bukowa
Copy link
Author

@bukowa bukowa commented Mar 2, 2021

I don't know about depreciating go get but because that command is related to modules - i believe it should be included in go mod

@seankhliao seankhliao changed the title subcommands related to "go mod" are not categorized under its "go help mod" ("go get") cmd/go: mention go get in go help mod Mar 2, 2021
@seankhliao seankhliao added Documentation GoCommand NeedsInvestigation labels Mar 2, 2021
@bcmills bcmills added NeedsFix help wanted labels Mar 2, 2021
@bcmills bcmills added this to the Backlog milestone Mar 2, 2021
@gopherbot gopherbot removed the NeedsInvestigation label Mar 2, 2021
codykaup added a commit to codykaup/go that referenced this issue Dec 28, 2021
This change adds a 'update' command to 'go mod' for updating module
dependencies.

Fixes golang#44726
codykaup added a commit to codykaup/go that referenced this issue Dec 28, 2021
This change adds an 'update' command to 'go mod' for updating module
dependencies.

Fixes golang#44726
@gopherbot
Copy link

@gopherbot gopherbot commented Dec 28, 2021

Change https://golang.org/cl/374614 mentions this issue: cmd/go: add go mod update command

@mvdan
Copy link
Member

@mvdan mvdan commented Dec 29, 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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Documentation GoCommand help wanted NeedsFix
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants