You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
invalidMajorVersionMsg:=fmt.Errorf("module paths beginning with gopkg.in/ must always have a major version suffix in the form of .vN:\n\tgo mod init %s", suggestGopkgIn(modPath))
modPathError.message="module paths beginning with gopkg.in/ must always have a major version suffix in the form of .vN"
1102
+
modPathError.suggestions= []string{fmt.Sprintf("go mod init %s", suggestGopkgIn(modPath))}
1103
+
} else {
1104
+
modPathError.message="major version suffixes must be in the form of /vN and are only allowed for v2 or later"
1105
+
modPathError.suggestions= []string{fmt.Sprintf("go mod init %s", suggestModulePath(modPath))}
1098
1106
}
1099
-
invalidMajorVersionMsg:=fmt.Errorf("major version suffixes must be in the form of /vN and are only allowed for v2 or later:\n\tgo mod init %s", suggestModulePath(modPath))
Copy file name to clipboardExpand all lines: src/cmd/go/testdata/script/mod_init_empty.txt
+3-3Lines changed: 3 additions & 3 deletions
Original file line number
Diff line number
Diff line change
@@ -14,19 +14,19 @@ env GOPATH=$WORK/gopath
14
14
# 'go mod init' should not create a go.mod file in v0 or v1 directory.
15
15
cd $GOPATH/src/example.com/m/v0
16
16
! go mod init
17
-
stderr '(?s)^go: cannot determine module path for source directory (.*v0) \(bad module path inferred from directory in GOPATH: major version suffixes must be in the form of /vN and are only allowed for v2 or later\)(.*)'
17
+
stderr '(?s)^go: invalid module path "example.com/m/v0" inferred from directory in GOPATH: major version suffixes must be in the form of /vN and are only allowed for v2 or later(.*)go mod init example.com/m/v2(.*)'
18
18
19
19
cd $GOPATH/src/example.com/m/v1
20
20
! go mod init
21
-
stderr '(?s)^go: cannot determine module path for source directory (.*v1) \(bad module path inferred from directory in GOPATH: major version suffixes must be in the form of /vN and are only allowed for v2 or later\)(.*)'
21
+
stderr '(?s)^go: invalid module path "example.com/m/v1" inferred from directory in GOPATH: major version suffixes must be in the form of /vN and are only allowed for v2 or later(.*)go mod init example.com/m/v2(.*)'
22
22
23
23
cd $GOPATH/src/example.com/m/v2
24
24
go mod init
25
25
stderr '^go: creating new go.mod: module example.com/m/v2$'
26
26
27
27
cd $GOPATH/src/gopkg.in/m
28
28
! go mod init
29
-
stderr '(?s)^go: cannot determine module path for source directory (.*m) \(bad module path inferred from directory in GOPATH: module paths beginning with gopkg.in/ must always have a major version suffix in the form of .vN\)(.*)'
29
+
stderr '(?s)^go: invalid module path "gopkg.in/m" inferred from directory in GOPATH: module paths beginning with gopkg.in/ must always have a major version suffix in the form of .vN(.*)'
Copy file name to clipboardExpand all lines: src/cmd/go/testdata/script/mod_init_invalid_major.txt
+16-16Lines changed: 16 additions & 16 deletions
Original file line number
Diff line number
Diff line change
@@ -2,34 +2,34 @@ env GO111MODULE=on
2
2
env GOFLAGS=-mod=mod
3
3
4
4
! go mod init example.com/user/repo/v0
5
-
stderr '(?s)^go: invalid module path "example.com/user/repo/v0": major version suffixes must be in the form of /vN and are only allowed for v2 or later(.*)go mod init example.com/user/repo/v2$'
5
+
stderr '(?s)^go: invalid module path "example.com/user/repo/v0": major version suffixes must be in the form of /vN and are only allowed for v2 or later(.*)go mod init example.com/user/repo/v2(.*)'
6
6
7
7
! go mod init example.com/user/repo/v02
8
-
stderr '(?s)^go: invalid module path "example.com/user/repo/v02": major version suffixes must be in the form of /vN and are only allowed for v2 or later(.*)go mod init example.com/user/repo/v2$'
8
+
stderr '(?s)^go: invalid module path "example.com/user/repo/v02": major version suffixes must be in the form of /vN and are only allowed for v2 or later(.*)go mod init example.com/user/repo/v2(.*)'
9
9
10
10
! go mod init example.com/user/repo/v023
11
-
stderr '(?s)^go: invalid module path "example.com/user/repo/v023": major version suffixes must be in the form of /vN and are only allowed for v2 or later(.*)go mod init example.com/user/repo/v23$'
11
+
stderr '(?s)^go: invalid module path "example.com/user/repo/v023": major version suffixes must be in the form of /vN and are only allowed for v2 or later(.*)go mod init example.com/user/repo/v23(.*)'
12
12
13
13
! go mod init example.com/user/repo/v1
14
-
stderr '(?s)^go: invalid module path "example.com/user/repo/v1": major version suffixes must be in the form of /vN and are only allowed for v2 or later(.*)go mod init example.com/user/repo/v2$'
14
+
stderr '(?s)^go: invalid module path "example.com/user/repo/v1": major version suffixes must be in the form of /vN and are only allowed for v2 or later(.*)go mod init example.com/user/repo/v2(.*)'
15
15
16
16
! go mod init example.com/user/repo/v2.0
17
-
stderr '(?s)^go: invalid module path "example.com/user/repo/v2.0": major version suffixes must be in the form of /vN and are only allowed for v2 or later(.*)go mod init example.com/user/repo/v2$'
17
+
stderr '(?s)^go: invalid module path "example.com/user/repo/v2.0": major version suffixes must be in the form of /vN and are only allowed for v2 or later(.*)go mod init example.com/user/repo/v2(.*)'
18
18
19
19
! go mod init example.com/user/repo/v2.1.4
20
-
stderr '(?s)^go: invalid module path "example.com/user/repo/v2.1.4": major version suffixes must be in the form of /vN and are only allowed for v2 or later(.*)go mod init example.com/user/repo/v2$'
20
+
stderr '(?s)^go: invalid module path "example.com/user/repo/v2.1.4": major version suffixes must be in the form of /vN and are only allowed for v2 or later(.*)go mod init example.com/user/repo/v2(.*)'
21
21
22
22
! go mod init example.com/user/repo/v3.5
23
-
stderr '(?s)^go: invalid module path "example.com/user/repo/v3.5": major version suffixes must be in the form of /vN and are only allowed for v2 or later(.*)go mod init example.com/user/repo/v3$'
23
+
stderr '(?s)^go: invalid module path "example.com/user/repo/v3.5": major version suffixes must be in the form of /vN and are only allowed for v2 or later(.*)go mod init example.com/user/repo/v3(.*)'
24
24
25
25
! go mod init example.com/user/repo/v4.1.4
26
-
stderr '(?s)^go: invalid module path "example.com/user/repo/v4.1.4": major version suffixes must be in the form of /vN and are only allowed for v2 or later(.*)go mod init example.com/user/repo/v4$'
26
+
stderr '(?s)^go: invalid module path "example.com/user/repo/v4.1.4": major version suffixes must be in the form of /vN and are only allowed for v2 or later(.*)go mod init example.com/user/repo/v4(.*)'
27
27
28
28
! go mod init example.com/user/repo/v.2.3
29
-
stderr '(?s)^go: invalid module path "example.com/user/repo/v.2.3": major version suffixes must be in the form of /vN and are only allowed for v2 or later(.*)go mod init example.com/user/repo/v2$'
29
+
stderr '(?s)^go: invalid module path "example.com/user/repo/v.2.3": major version suffixes must be in the form of /vN and are only allowed for v2 or later(.*)go mod init example.com/user/repo/v2(.*)'
30
30
31
31
! go mod init example.com/user/repo/v.5.3
32
-
stderr '(?s)^go: invalid module path "example.com/user/repo/v.5.3": major version suffixes must be in the form of /vN and are only allowed for v2 or later(.*)go mod init example.com/user/repo/v5$'
32
+
stderr '(?s)^go: invalid module path "example.com/user/repo/v.5.3": major version suffixes must be in the form of /vN and are only allowed for v2 or later(.*)go mod init example.com/user/repo/v5(.*)'
33
33
34
34
! go mod init gopkg.in/pkg
35
35
stderr '(?s)^go: invalid module path "gopkg.in/pkg": module paths beginning with gopkg.in/ must always have a major version suffix in the form of .vN(.*)go mod init gopkg.in/pkg.v1$'
0 commit comments