]> Cypherpunks repositories - gostls13.git/commit
[dev.cmdgo] cmd/go: fix calls to modFileGoVersion to pass in modFile
authorMichael Matloob <matloob@golang.org>
Tue, 24 Aug 2021 16:37:15 +0000 (12:37 -0400)
committerMichael Matloob <matloob@golang.org>
Wed, 25 Aug 2021 17:23:06 +0000 (17:23 +0000)
commitde23549a3967ade982d848a5b6ae3cb3fa0dba45
treeb176a2f18b79f6829fd56ecfb11e84d66a0cdf03
parent3b523caf4145c2d915c5ead69440f9b890634587
[dev.cmdgo] cmd/go: fix calls to modFileGoVersion to pass in modFile

Before this change, we were arbitrarily picking a module to get the Go
version from in calls to modFileGoVersion. We now pass in the modFile to
modFileGoVersion when we have the file. Most of the calls were to get
the goVersion argument for commitRequirements, so now we have
commitRequirements call modFileGoVersion on the modFile directly
One of the calls to commitRequirements (when running go mod tidy with
a different Go version) passed in a new go version to update the file
to. Now, the modFile is updated before calling commitRequirements.

For the remaining cases of modFileGoVersion, it's replaced by a call to
the new (*MainModuleSet).GoVersion function, which either returns the go
version on the workspace file (in workspace mode) or the version of the
single go.mod file.

Change-Id: Ie88c3ca76c7f29ffc4faa16bb76f6cb7eccb5029
Reviewed-on: https://go-review.googlesource.com/c/go/+/344749
Trust: Michael Matloob <matloob@golang.org>
Run-TryBot: Michael Matloob <matloob@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Jay Conrod <jayconrod@google.com>
src/cmd/go/internal/modload/buildlist.go
src/cmd/go/internal/modload/init.go
src/cmd/go/internal/modload/list.go
src/cmd/go/internal/modload/load.go
src/cmd/go/internal/modload/modfile.go