]> Cypherpunks repositories - gostls13.git/commit
cmd/go: use a nil *Origin to represent "uncheckable"
authorBryan C. Mills <bcmills@google.com>
Thu, 16 Nov 2023 22:03:06 +0000 (17:03 -0500)
committerGopher Robot <gobot@golang.org>
Fri, 17 Nov 2023 22:43:50 +0000 (22:43 +0000)
commit0b90c7d4453bb21ec3ad4d6c5a3eebf398a89e77
tree13e225d49c5a9accee86b02157b175266b6f48c6
parentbb8a96fa547985168241eea72ee2bec15e749eff
cmd/go: use a nil *Origin to represent "uncheckable"

Previously, we used the presence of individual origin fields
to decide whether an Origin could be checked for staleness,
with a nil Origin representing “use whatever you have”.

However, that turns out to be fairly bug-prone: if we forget
to populate an Origin somewhere, we end up with an incomplete
check instead of a non-reusable origin (see #61415, #61423).

As of CL 543155, the reusability check for a given query
now depends on what is needed by the query more than what
is populated in the origin. With that in place, we can simplify
the handling of the Origin struct by using a nil pointer
to represent inconsistent or unavailable origin data, and
otherwise always reporting whatever origin information we have
regardless of whether we expect it to be reused.

Updates #61415.
Updates #61423.

Change-Id: I97c51063d6c2afa394a05bf304a80c72c08f82cf
Cq-Include-Trybots: luci.golang.try:gotip-linux-amd64-longtest,gotip-windows-amd64-longtest
Reviewed-on: https://go-review.googlesource.com/c/go/+/543216
Auto-Submit: Bryan Mills <bcmills@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Michael Matloob <matloob@golang.org>
src/cmd/go/internal/modfetch/codehost/codehost.go
src/cmd/go/internal/modfetch/coderepo.go
src/cmd/go/internal/modload/build.go
src/cmd/go/internal/modload/list.go
src/cmd/go/internal/modload/query.go
src/cmd/go/testdata/script/mod_list_issue61423.txt