aboutsummaryrefslogtreecommitdiff
path: root/src/cmd/go/testdata/script/mod_tidy_too_new.txt
diff options
context:
space:
mode:
authorRuss Cox <rsc@golang.org>2023-05-23 12:09:09 -0400
committerRuss Cox <rsc@golang.org>2023-05-23 17:13:02 +0000
commit1a22008f2f3d4d5ea3e6b26b8ae9c6ce5d7f848f (patch)
treebf414f33622664f866f6fc9c0c63130f70bb9502 /src/cmd/go/testdata/script/mod_tidy_too_new.txt
parent9dd0c7fc78cb19000f15bd58a3a1ab5ae1c6a84b (diff)
downloadgo-1a22008f2f3d4d5ea3e6b26b8ae9c6ce5d7f848f.tar.gz
go-1a22008f2f3d4d5ea3e6b26b8ae9c6ce5d7f848f.zip
cmd/go: refuse to run when the main module or workspace needs a newer Go
We already refuse to build code in modules are too new (CL 476279). This is a more comprehensive check: refuse to do anything at all with modules or workspaces that are too new. Since the module or workspace is new, it may have semantics we don't understand and misinterpret well before we get to the actual building of code. For example when we switched from // +build to //go:build that changed the decision about which files go into a package, which affects the way the overall load phase runs and which errors it reports. Waiting until the building of code would miss earlier changes like that one. Leaving the test from CL 476279 alone, but it's not load-bearing anymore. For #57001. Change-Id: I8c39943db1d7ddbcb9b5cae68d80459fddd68151 Reviewed-on: https://go-review.googlesource.com/c/go/+/497435 TryBot-Result: Gopher Robot <gobot@golang.org> Run-TryBot: Russ Cox <rsc@golang.org> Reviewed-by: Bryan Mills <bcmills@google.com> Auto-Submit: Russ Cox <rsc@golang.org>
Diffstat (limited to 'src/cmd/go/testdata/script/mod_tidy_too_new.txt')
-rw-r--r--src/cmd/go/testdata/script/mod_tidy_too_new.txt59
1 files changed, 0 insertions, 59 deletions
diff --git a/src/cmd/go/testdata/script/mod_tidy_too_new.txt b/src/cmd/go/testdata/script/mod_tidy_too_new.txt
deleted file mode 100644
index 875cb7f9afe..00000000000
--- a/src/cmd/go/testdata/script/mod_tidy_too_new.txt
+++ /dev/null
@@ -1,59 +0,0 @@
-# https://golang.org/issue/46142: 'go mod tidy' should error out if the version
-# in the go.mod file is newer than the most recent supported version.
-
-env GOTOOLCHAIN=local
-
-cp go.mod go.mod.orig
-
-
-# If the go.mod file specifies an unsupported Go version, 'go mod tidy' should
-# refuse to edit it: we don't know what a tidy go.mod file for that version
-# would look like.
-
-! go mod tidy
-stderr 'go: go.mod file indicates go 2000.0, but maximum version supported by tidy is '$goversion'$'
-cmp go.mod go.mod.orig
-
-
-# The -e flag should push past the error and edit the file anyway,
-# but preserve the too-high version.
-
-cp go.mod.orig go.mod
-go mod tidy -e
-stderr 'go: go.mod file indicates go 2000.0, but maximum version supported by tidy is '$goversion'$'
-cmp go.mod go.mod.tidy
-
-
-# Explicitly switching to a supported version should suppress the error completely.
-
-cp go.mod.orig go.mod
-go mod tidy -go=1.17
-! stderr 'maximum supported version'
-go mod edit -go=1.17 go.mod.tidy
-cmp go.mod go.mod.tidy
-
-
--- go.mod --
-module example.net/from/the/future
-
-go 2000.0
-
-replace example.net/m v0.0.0 => ./m
--- go.mod.tidy --
-module example.net/from/the/future
-
-go 2000.0
-
-replace example.net/m v0.0.0 => ./m
-
-require example.net/m v0.0.0
--- x.go --
-package x
-
-import "example.net/m"
--- m/go.mod --
-module example.net/m
-
-go 1.17
--- m/m.go --
-package m