Skip to content

cmd/go: mod is too much of a grab bag #26581

Closed
@robpike

Description

@robpike

The UX model for go mod is to define what the operation is by setting a flag. This is an odd model that I suspect just fell out of the way the go command already works. But I find it odd, and it mixes mandatory and optional flags together in odd ways.

It will take some rearchitecting but the operations should be specified as subcommands, not flags, like this:

$ go mod init foo.bar/package

Besides being a better match for the usage, this would enable two important changes: First, a help enabler could be added; today we get

$ go mod -help -init
usage: mod [-v] [maintenance flags]
Run 'go help mod' for details.
$

which is no help at all, really, when we could have

$ go mod help init
The init subcommand does this and that and has these flags...

Similarly, by turning these actual commands into syntactic commands, we open up the possibility of having flags on them, with the usual advantages (and disadvantages) and clarity that results.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions