Skip to content

cmd/go: implement Mercurial support for go mod download -reuse, go list -reuse #75119

@rsc

Description

@rsc

The go mod download -reuse and go list -reuse flags greatly reduce the amount of network traffic required for check whether a particular version query or version list is up to date. It is used by the Go module mirror (proxy.golang.org) when checking whether its cached information is up-to-date.

We have only implemented support for -reuse when the remote repository is Git, in part because Git is the dominant version control system used for Go modules and in part because we didn’t see how to implement it for any of the other version control systems.

Prompted by #75120, I now see a way to implement -reuse for Mercurial. Although the standard hg command does not provide the information we need, the extension APIs and remote wire protocols have just barely enough capability to do it. We can write and ship our own Mercurial extension in the Go distribution and have the go command enable that extension on the command line when invoking hg for its own use. This issue tracks that implementation.

If we implement and ship Mercurial support for -reuse in Go 1.26, then proxy.golang.org can start using it shortly after the Go 1.26.0 release, which will reduce the amount of traffic sent to Mercurial servers hosting Go modules.

Of course, handling Mercurial still leaves the other version control systems. Subversion never does a full clone of the remote repository, so it doesn’t need -reuse. (Or it gets -reuse for free, depending on how you look at it.) I don’t see how to implement -reuse for Fossil and Bazaar, but they are also a very small fraction of Go modules. For now we can focus on Mercurial.

Metadata

Metadata

Assignees

Labels

GoCommandcmd/goNeedsFixThe path to resolution is known, but the work has not been done.ToolProposalIssues describing a requested change to a Go tool or command-line program.

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions