...

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

Documentation: cmd/go/testdata/script

     1go work init
     2go work use . ./sub
     3
     4# Verify that the go.mod files for both modules in the workspace are tidy,
     5# and add missing go.sum entries as needed.
     6
     7cp go.mod go.mod.orig
     8go mod tidy
     9cmp go.mod go.mod.orig
    10
    11cd sub
    12cp go.mod go.mod.orig
    13go mod tidy
    14cmp go.mod go.mod.orig
    15cd ..
    16
    17go list -m all
    18stdout '^rsc\.io/quote v1\.5\.1$'
    19stdout '^rsc\.io/sampler v1\.3\.1$'
    20
    21# Now remove the module dependencies from the module cache.
    22# Because one module upgrades a transitive dependency needed by another,
    23# listing the modules in the workspace should error out.
    24
    25go clean -modcache
    26env GOPROXY=off
    27! go list -m all
    28stderr '^go: rsc.io/sampler@v1.3.0: module lookup disabled by GOPROXY=off$'
    29
    30-- example.go --
    31package example
    32
    33import _ "rsc.io/sampler"
    34-- go.mod --
    35module example
    36
    37go 1.19
    38
    39require rsc.io/sampler v1.3.0
    40
    41require (
    42	golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c // indirect
    43	rsc.io/testonly v1.0.0 // indirect
    44)
    45-- sub/go.mod --
    46module example/sub
    47
    48go 1.19
    49
    50require rsc.io/quote v1.5.1
    51
    52require (
    53	golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c // indirect
    54	rsc.io/sampler v1.3.1 // indirect
    55)
    56-- sub/sub.go --
    57package example
    58
    59import _ "rsc.io/quote"

View as plain text