Skip to content

cmd/go: go tool and go get -tool could be documented better #77346

@mvdan

Description

@mvdan

I keep finding that experienced Go users are unaware of how great this new feature is. I find two sources of confusion in particular:

  1. They are unaware that go get -tool exists; they instead edit go.mod manually, for example.
  2. They are unaware that go tool bar works as a short-hand for go tool foo.com/full/package/path/bar.

I suggest that we improve the UX here in three ways. First, make go help tool point to go get -tool and vice versa, so that I can discover the existence of both commands by looking at the help of either.

Second, tweak go help tool so that this alias logic is actually documented. I assume it's based on the basename, but I'm not actually sure if the package name plays any part in it. It should also explain what happens with alias conflicts.

Third, tweak go tool without arguments so that it shows the available aliases, such as:

$ go tool
asm
cgo
[...]
foo.com/full/package/path/bar (alias: bar)

cc @golang/tools-team

Metadata

Metadata

Assignees

No one assigned

    Labels

    DocumentationIssues describing a change to documentation.GoCommandcmd/goNeedsInvestigationSomeone must examine and confirm this is a valid issue and not a duplicate of an existing one.ToolProposalIssues describing a requested change to a Go tool or command-line program.help wanted

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions