...

Text file src/cmd/go/testdata/script/mod_init_invalid_major.txt

Documentation: cmd/go/testdata/script

     1env GO111MODULE=on
     2env GOFLAGS=-mod=mod
     3
     4! go mod init example.com/user/repo/v0
     5stderr '(?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
     7! go mod init example.com/user/repo/v02
     8stderr '(?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
    10! go mod init example.com/user/repo/v023
    11stderr '(?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
    13! go mod init example.com/user/repo/v1
    14stderr '(?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
    16! go mod init example.com/user/repo/v2.0
    17stderr '(?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
    19! go mod init example.com/user/repo/v2.1.4
    20stderr '(?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
    22! go mod init example.com/user/repo/v3.5
    23stderr '(?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
    25! go mod init example.com/user/repo/v4.1.4
    26stderr '(?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
    28! go mod init example.com/user/repo/v.2.3
    29stderr '(?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
    31! go mod init example.com/user/repo/v.5.3
    32stderr '(?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
    34! go mod init gopkg.in/pkg
    35stderr '(?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$'
    36
    37! go mod init gopkg.in/user/pkg
    38stderr '(?s)^go: invalid module path "gopkg.in/user/pkg": module paths beginning with gopkg.in/ must always have a major version suffix in the form of .vN(.*)go mod init gopkg.in/user/pkg.v1$'
    39
    40! go mod init gopkg.in/user/pkg/v0
    41stderr '(?s)^go: invalid module path "gopkg.in/user/pkg/v0": module paths beginning with gopkg.in/ must always have a major version suffix in the form of .vN(.*)go mod init gopkg.in/user/pkg.v1$'
    42
    43! go mod init gopkg.in/user/pkg/v1
    44stderr '(?s)^go: invalid module path "gopkg.in/user/pkg/v1": module paths beginning with gopkg.in/ must always have a major version suffix in the form of .vN(.*)go mod init gopkg.in/user/pkg.v1$'
    45
    46! go mod init gopkg.in/user/pkg/v2
    47stderr '(?s)^go: invalid module path "gopkg.in/user/pkg/v2": module paths beginning with gopkg.in/ must always have a major version suffix in the form of .vN(.*)go mod init gopkg.in/user/pkg.v2$'
    48
    49! go mod init gopkg.in/user/pkg.v
    50stderr '(?s)^go: invalid module path "gopkg.in/user/pkg.v": module paths beginning with gopkg.in/ must always have a major version suffix in the form of .vN(.*)go mod init gopkg.in/user/pkg.v1$'
    51
    52! go mod init gopkg.in/user/pkg.v0.1
    53stderr '(?s)^go: invalid module path "gopkg.in/user/pkg.v0.1": module paths beginning with gopkg.in/ must always have a major version suffix in the form of .vN(.*)go mod init gopkg.in/user/pkg.v1$'
    54
    55! go mod init gopkg.in/user/pkg.v.1
    56stderr '(?s)^go: invalid module path "gopkg.in/user/pkg.v.1": module paths beginning with gopkg.in/ must always have a major version suffix in the form of .vN(.*)go mod init gopkg.in/user/pkg.v1$'
    57
    58! go mod init gopkg.in/user/pkg.v01
    59stderr '(?s)^go: invalid module path "gopkg.in/user/pkg.v01": module paths beginning with gopkg.in/ must always have a major version suffix in the form of .vN(.*)go mod init gopkg.in/user/pkg.v1$'
    60
    61! go mod init gopkg.in/user/pkg.v.2.3
    62stderr '(?s)^go: invalid module path "gopkg.in/user/pkg.v.2.3": module paths beginning with gopkg.in/ must always have a major version suffix in the form of .vN(.*)go mod init gopkg.in/user/pkg.v2$'
    63
    64# module paths with a trailing dot are rejected as invalid import paths
    65! go mod init example.com/user/repo/v2.
    66stderr '(?s)^go: malformed module path "example.com/user/repo/v2.": trailing dot in path element$'
    67
    68! go mod init example.com/user/repo/v2..
    69stderr '(?s)^go: malformed module path "example.com/user/repo/v2..": trailing dot in path element$'
    70
    71! go mod init gopkg.in/user/pkg.v.2.
    72stderr '(?s)^go: malformed module path "gopkg.in/user/pkg.v.2.": trailing dot in path element$'
    73
    74! go mod init gopkg.in/user/pkg.v.2..
    75stderr '(?s)^go: malformed module path "gopkg.in/user/pkg.v.2..": trailing dot in path element$'
    76
    77# module paths with spaces are also rejected
    78! go mod init 'foo bar'
    79stderr '(?s)^go: malformed module path "foo bar": invalid char '' ''$'
    80
    81! go mod init 'foo  bar baz'
    82stderr '(?s)^go: malformed module path "foo  bar baz": invalid char '' ''$'

View as plain text