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

     1  env GO111MODULE=on
     2  env GOFLAGS=-mod=mod
     3  
     4  # go mod init should populate go.mod from Gopkg.lock
     5  go mod init x
     6  stderr 'copying requirements from Gopkg.lock'
     7  go list -m all
     8  stdout 'rsc.io/sampler v1.0.0'
     9  
    10  # test dep replacement
    11  cd y
    12  go mod init
    13  cmpenv go.mod go.mod.replace
    14  
    15  -- x.go --
    16  package x
    17  
    18  -- Gopkg.lock --
    19  [[projects]]
    20    name = "rsc.io/sampler"
    21    version = "v1.0.0"
    22  
    23  -- y/Gopkg.lock --
    24  [[projects]]
    25    name = "z"
    26    revision = "v1.0.0"
    27    source = "rsc.io/quote"
    28  
    29  -- y/y.go --
    30  package y // import "y"
    31  import _ "z"
    32  
    33  -- y/go.mod.replace --
    34  module y
    35  
    36  go $goversion
    37  
    38  replace z v1.0.0 => rsc.io/quote v1.0.0
    39  
    40  require rsc.io/quote v1.0.0
    41  

View as plain text