]> Cypherpunks repositories - gostls13.git/commit
cmd/go: record origin metadata during module download
authorRuss Cox <rsc@golang.org>
Thu, 9 Jun 2022 03:56:28 +0000 (23:56 -0400)
committerRuss Cox <rsc@golang.org>
Tue, 5 Jul 2022 12:57:42 +0000 (12:57 +0000)
commit84e091eef033255b4a3fdb515d677faa135714dc
tree0534ac81e1a3bab590b016892f6bc5eec7146bac
parentceda93ed673294f0ce5eb3a723d563091bff0a39
cmd/go: record origin metadata during module download

This change adds an "Origin" JSON key to the output of
go list -json -m and go mod download -json. The associated value is a
JSON object with metadata about the source control system. For Git,
that metadata is sufficient to evaluate whether the remote server has
changed in any interesting way that might invalidate the cached data.
In most cases, it will not have, and a fetch could then avoid
downloading a full repo from the server.

This origin metadata is also now recorded in the .info file for a
given module@version, for informational and debugging purposes.

This change only adds the metadata. It does not use it to optimize
away unnecessary git fetch operations. (That's the next change.)

For #53644.

Change-Id: I4a1712a2386d1d8ab4e02ffdf0f72ba75d556115
Reviewed-on: https://go-review.googlesource.com/c/go/+/411397
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Russ Cox <rsc@golang.org>
Reviewed-by: Bryan Mills <bcmills@google.com>
12 files changed:
src/cmd/go/internal/modcmd/download.go
src/cmd/go/internal/modfetch/cache.go
src/cmd/go/internal/modfetch/codehost/codehost.go
src/cmd/go/internal/modfetch/codehost/git.go
src/cmd/go/internal/modfetch/codehost/git_test.go
src/cmd/go/internal/modfetch/codehost/vcs.go
src/cmd/go/internal/modfetch/coderepo.go
src/cmd/go/internal/modfetch/coderepo_test.go
src/cmd/go/internal/modfetch/proxy.go
src/cmd/go/internal/modfetch/repo.go
src/cmd/go/internal/modload/mvs.go
src/cmd/go/internal/modload/query.go