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

     1  # Check that 'go get -u' will upgrade a dependency (direct or indirect)
     2  # when the main module and the dependency are both lazy.
     3  # Verifies #47768.
     4  
     5  # Check that go.mod is tidy, and an upgrade is available.
     6  cp go.mod go.mod.orig
     7  go mod tidy
     8  cmp go.mod go.mod.orig
     9  
    10  go list -m -u example.com/lazyupgrade
    11  stdout '^example.com/lazyupgrade v0.1.0 \[v0.1.1\] => ./lazyupgrade@v0.1.0$'
    12  
    13  # 'go get -u' on a package that directly imports the dependency should upgrade.
    14  go get -u ./usedirect
    15  go list -m example.com/lazyupgrade
    16  stdout '^example.com/lazyupgrade v0.1.1 => ./lazyupgrade@v0.1.1$'
    17  cp go.mod.orig go.mod
    18  
    19  # 'go get -u' on a package that indirectly imports the dependency should upgrade.
    20  go get -u ./useindirect
    21  go list -m example.com/lazyupgrade
    22  stdout '^example.com/lazyupgrade v0.1.1 => ./lazyupgrade@v0.1.1$'
    23  
    24  -- go.mod --
    25  module use
    26  
    27  go 1.17
    28  
    29  require (
    30  	direct v0.0.0
    31  	example.com/lazyupgrade v0.1.0
    32  )
    33  
    34  replace (
    35  	direct => ./direct
    36  	example.com/lazyupgrade v0.1.0 => ./lazyupgrade@v0.1.0
    37  	example.com/lazyupgrade v0.1.1 => ./lazyupgrade@v0.1.1
    38  )
    39  -- usedirect/usedirect.go --
    40  package use
    41  
    42  import _ "example.com/lazyupgrade"
    43  -- useindirect/useindirect.go --
    44  package use
    45  
    46  import _ "direct"
    47  -- direct/go.mod --
    48  module direct
    49  
    50  go 1.17
    51  
    52  require example.com/lazyupgrade v0.1.0
    53  -- direct/direct.go --
    54  package direct
    55  
    56  import _ "example.com/lazyupgrade"
    57  -- lazyupgrade@v0.1.0/go.mod --
    58  module example.com/lazyupgrade
    59  
    60  go 1.17
    61  -- lazyupgrade@v0.1.0/lazyupgrade.go --
    62  package lazyupgrade
    63  -- lazyupgrade@v0.1.1/go.mod --
    64  module example.com/lazyupgrade
    65  
    66  go 1.17
    67  -- lazyupgrade@v0.1.1/lazyupgrade.go --
    68  package lazyupgrade
    69  

View as plain text