Skip to content

cmd/go: add a go work use command #48257

Closed
@matloob

Description

@matloob

This proposal is an amendment of the Go Workspace Proposal (#45713) originally suggested by @jayconrod in a comment on that issue:

I'd like a way to add all modules in a subtree to a workspace using wildcards. Specifically, I'd like go workspace add ./....

  • go workspace use would be a better subcommand name if we end up using that in go.work.
  • I think this would help build a more familiar environment for folks used to working on related projects in GOPATH. I could put a go.work file in $GOPATH/src, then just have one VSCode window for all projects.
  • We've talked about supporting wildcards in go mod initwork and go mod editwork, but that breaks some parallelism with go mod init, which only creates an empty go.mod file, and go mod edit, which only performs low-level syntactic edits without extra processing.

This proposal would add a new go command subcommand, perhaps called go mod addwork (if #48256 is accepted, the new subcommand would be called go work add or go work use).

It would ensure that the go.work command contains modules denoted by the given pattern, removing any matches of the pattern that no longer exist on disk.

cc @bcmills @ianthehat

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions