...

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

Documentation: cmd/go/testdata/script

     1# Check that go line in go.work is always >= go line of used modules.
     2
     3# Using an old Go version, fails during module loading, but we rewrite the error to the
     4# same one a switching version would use, without the auto-switch.
     5# This is a misconfigured system that should not arise in practice.
     6env TESTGO_VERSION=go1.21.1
     7env TESTGO_VERSION_SWITCH=switch
     8cp go.work go.work.orig
     9! go list
    10stderr '^go: module . listed in go.work file requires go >= 1.21.2, but go.work lists go 1.21.1; to update it:\n\tgo work use$'
    11go work use
    12go list
    13
    14# Using a new enough Go version, fails later and can suggest 'go work use'.
    15env TESTGO_VERSION=go1.21.2
    16env TESTGO_VERSION_SWITCH=switch
    17cp go.work.orig go.work
    18! go list
    19stderr '^go: module . listed in go.work file requires go >= 1.21.2, but go.work lists go 1.21.1; to update it:\n\tgo work use$'
    20
    21# go work use fixes the problem.
    22go work use
    23go list
    24
    25-- go.work --
    26go 1.21.1
    27use .
    28
    29-- go.mod --
    30module m
    31go 1.21.2
    32
    33-- p.go --
    34package p

View as plain text