github.com/gagliardetto/golang-go@v0.0.0-20201020153340-53909ea70814/cmd/go/testdata/script/mod_vendor_build.txt (about)

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