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

     1  env GO111MODULE=on
     2  [short] skip
     3  
     4  # Populate go.mod and go.sum.
     5  go mod tidy
     6  
     7  # initial conditions: using sampler v1.3.0, not listed in go.mod.
     8  go list -deps
     9  stdout rsc.io/sampler
    10  ! grep 'rsc.io/sampler v1.3.0' go.mod
    11  
    12  # update to v1.3.1, now indirect in go.mod.
    13  go get rsc.io/sampler@v1.3.1
    14  grep 'rsc.io/sampler v1.3.1 // indirect' go.mod
    15  cp go.mod go.mod.good
    16  
    17  # vendoring can but should not need to make changes.
    18  go mod vendor
    19  cmp go.mod go.mod.good
    20  
    21  # go list -mod=vendor (or go build -mod=vendor) must not modify go.mod.
    22  # golang.org/issue/26704
    23  go list -mod=vendor
    24  cmp go.mod go.mod.good
    25  
    26  # With a clean (and empty) module cache, 'go list -mod=vendor' should not download modules.
    27  go clean -modcache
    28  env GOPROXY=off
    29  ! go list ...
    30  go list -mod=vendor ...
    31  
    32  # However, it should still list packages in the main module.
    33  go list -mod=vendor m/...
    34  stdout m
    35  
    36  -- go.mod --
    37  module m
    38  go 1.12
    39  -- x.go --
    40  package x
    41  import _ "rsc.io/quote"
    42  

View as plain text