...

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

Documentation: cmd/go/testdata/script

     1# Go should refuse to build code that is too new according to go.mod.
     2
     3# go.mod too new
     4env GOTOOLCHAIN=local
     5! go build .
     6stderr '^go: go.mod requires go >= 1.99999 \(running go 1\..+\)$'
     7
     8# go.mod referenced from go.work too new
     9cp go.work.old go.work
    10! go build .
    11stderr '^go: module . listed in go.work file requires go >= 1.99999, but go.work lists go 1.10; to update it:\n\tgo work use$'
    12
    13! go work sync
    14stderr '^go: cannot load module . listed in go.work file: go.mod requires go >= 1.99999 \(running go 1\..+\)$'
    15
    16# go.work too new
    17cp go.work.new go.work
    18cp go.mod.old go.mod
    19! go build .
    20stderr '^go: go.work requires go >= 1.99999 \(running go 1\..+\)$'
    21
    22# vendor too new
    23rm go.work
    24mv notvendor vendor
    25! go build -mod=vendor .
    26stderr '^go: golang.org/x/text in vendor'${/}'modules.txt requires go >= 1.99999 \(running go 1\..+\)$'
    27
    28-- go.mod --
    29module example
    30go 1.99999
    31
    32-- p.go --
    33package p
    34
    35-- go.mod.old --
    36module example
    37go 1.10
    38
    39-- go.work.new --
    40go 1.99999
    41use .
    42
    43-- go.work.old --
    44go 1.10
    45use .
    46
    47-- notvendor/modules.txt --
    48# golang.org/x/text v0.9.0
    49## explicit; go 1.99999
    50golang.org/x/text/internal/language

View as plain text