aboutsummaryrefslogtreecommitdiff
path: root/src/cmd/go/testdata/script/mod_tidy_too_new.txt
blob: b9c53b510daeb06c5d91e8fb2c720d5dd89b12ca (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
# 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.

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 mod tidy: go.mod file indicates go 2000.0, but maximum supported version 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 mod tidy: go.mod file indicates go 2000.0, but maximum supported version 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