]> Cypherpunks repositories - gostls13.git/commit
cmd/go/internal/modload: in newRequirements, verify that rootModules is sorted
authorBryan C. Mills <bcmills@google.com>
Fri, 16 Apr 2021 04:47:35 +0000 (00:47 -0400)
committerBryan C. Mills <bcmills@google.com>
Wed, 21 Apr 2021 04:27:01 +0000 (04:27 +0000)
commitf53c2fac46e2e193493045eef08591ded1496b74
tree256bdfac37e3bd647e379b5540c3f80d45c060f4
parent69c94ad55f9bf3072a5ad466b779e1427a3a07e0
cmd/go/internal/modload: in newRequirements, verify that rootModules is sorted

The comment for the Requirements.rootModules field requires that it be
"sorted and capped to length". I noticed that we were not capping it
correctly — we were capping the local variable (the rorotModules
argument itself) but not the struct field. That prompted me to
question whether we were also at some point failing to sort it
correctly, so I decided to add an explicit check.

With the explicit check, all tests continue to pass.

For #36460

Change-Id: I6687de8ef8ecc5129fa8810d678e5673752fd27b
Reviewed-on: https://go-review.googlesource.com/c/go/+/310790
Trust: Bryan C. Mills <bcmills@google.com>
Run-TryBot: Bryan C. Mills <bcmills@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Jay Conrod <jayconrod@google.com>
Reviewed-by: Michael Matloob <matloob@golang.org>
src/cmd/go/internal/modload/buildlist.go