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

     1  env GO111MODULE=on
     2  env GOFLAGS=-mod=mod
     3  
     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$'
     6  
     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$'
     9  
    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$'
    12  
    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$'
    15  
    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$'
    18  
    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$'
    21  
    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$'
    24  
    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$'
    27  
    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$'
    30  
    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$'
    33  
    34  ! go mod init gopkg.in/pkg
    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$'
    36  
    37  ! go mod init gopkg.in/user/pkg
    38  stderr '(?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
    41  stderr '(?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
    44  stderr '(?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
    47  stderr '(?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
    50  stderr '(?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
    53  stderr '(?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
    56  stderr '(?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
    59  stderr '(?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
    62  stderr '(?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.
    66  stderr '(?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..
    69  stderr '(?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.
    72  stderr '(?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..
    75  stderr '(?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'
    79  stderr '(?s)^go: malformed module path "foo bar": invalid char '' ''$'
    80  
    81  ! go mod init 'foo  bar baz'
    82  stderr '(?s)^go: malformed module path "foo  bar baz": invalid char '' ''$'
    83  

View as plain text