aboutsummaryrefslogtreecommitdiff
path: root/src/cmd/go/internal/modcmd/tidy.go
diff options
context:
space:
mode:
authorBryan C. Mills <bcmills@google.com>2021-05-13 09:48:40 -0400
committerCarlos Amedee <carlos@golang.org>2021-06-02 19:01:28 +0000
commitfbf844b46d147c442a6016aa9c6bef51c309257b (patch)
treec12e0c83b9dea30c1b5ceb1a4db3a4acbc0a4f03 /src/cmd/go/internal/modcmd/tidy.go
parentd9cffabed288ebece50ece29d44eff283e5cc485 (diff)
downloadgo-fbf844b46d147c442a6016aa9c6bef51c309257b.tar.gz
go-fbf844b46d147c442a6016aa9c6bef51c309257b.zip
[release-branch.go1.15] cmd/go: error out of 'go mod tidy' if the go version is newer than supported
This backports the test from CL 319669, but — because of extensive changes to the module loader during the Go 1.16 and 1.17 cycles — the implementation is entirely different. (This implementation is based on the addGoStmt function already present in init.go.) Fixes #46143 Updates #46142 Change-Id: Ib7a0a159e53cbe476be6aa9a050add10cc750dec Reviewed-on: https://go-review.googlesource.com/c/go/+/319710 Trust: Bryan C. Mills <bcmills@google.com> Run-TryBot: Bryan C. Mills <bcmills@google.com> Reviewed-by: Jay Conrod <jayconrod@google.com> TryBot-Result: Go Bot <gobot@golang.org>
Diffstat (limited to 'src/cmd/go/internal/modcmd/tidy.go')
-rw-r--r--src/cmd/go/internal/modcmd/tidy.go1
1 files changed, 1 insertions, 0 deletions
diff --git a/src/cmd/go/internal/modcmd/tidy.go b/src/cmd/go/internal/modcmd/tidy.go
index 5ff847485c..71e1eda44a 100644
--- a/src/cmd/go/internal/modcmd/tidy.go
+++ b/src/cmd/go/internal/modcmd/tidy.go
@@ -43,6 +43,7 @@ func runTidy(cmd *base.Command, args []string) {
}
modload.SilenceMissingStdImports = true
+ modload.CheckTidyVersion()
modload.LoadALL()
modload.TidyBuildList()
modTidyGoSum() // updates memory copy; WriteGoMod on next line flushes it out