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

     1  [short] skip
     2  env GO111MODULE=on
     3  
     4  # Download everything to avoid "finding" messages in stderr later.
     5  cp go.mod.orig go.mod
     6  go mod download
     7  go mod download example.com@v1.0.0
     8  go mod download example.com/badchain/a@v1.1.0
     9  go mod download example.com/badchain/b@v1.1.0
    10  go mod download example.com/badchain/c@v1.1.0
    11  
    12  # Try to update example.com/badchain/a (and its dependencies).
    13  ! go get example.com/badchain/a
    14  cmp stderr update-a-expected
    15  cmp go.mod go.mod.orig
    16  
    17  # Try to update the main module. This updates everything, including
    18  # modules that aren't direct requirements, so the error stack is shorter.
    19  go get -u ./...
    20  cmp stderr update-main-expected
    21  cmp go.mod go.mod.withc
    22  
    23  # Update manually. Listing modules should produce an error.
    24  cp go.mod.orig go.mod
    25  go mod edit -require=example.com/badchain/a@v1.1.0
    26  ! go list -m all
    27  cmp stderr list-expected
    28  
    29  # Try listing a package that imports a package
    30  # in a module without a requirement.
    31  go mod edit -droprequire example.com/badchain/a
    32  ! go list -mod=mod m/use
    33  cmp stderr list-missing-expected
    34  
    35  ! go list -mod=mod -test m/testuse
    36  cmp stderr list-missing-test-expected
    37  
    38  -- go.mod.orig --
    39  module m
    40  
    41  go 1.13
    42  
    43  require example.com/badchain/a v1.0.0
    44  -- go.mod.withc --
    45  module m
    46  
    47  go 1.13
    48  
    49  require (
    50  	example.com/badchain/a v1.0.0
    51  	example.com/badchain/c v1.0.0
    52  )
    53  -- go.sum --
    54  example.com/badchain/a v1.0.0 h1:iJDLiHLmpQgr9Zrv+44UqywAE2IG6WkHnH4uG08vf+s=
    55  example.com/badchain/a v1.0.0/go.mod h1:6/gnCYHdVrs6mUgatUYUSbuHxEY+/yWedmTggLz23EI=
    56  example.com/badchain/a v1.1.0 h1:cPxQpsOjaIrn05yDfl4dFFgGSbjYmytLqtIIBfTsEqA=
    57  example.com/badchain/a v1.1.0/go.mod h1:T15b2BEK+RY7h7Lr2dgS38p1pgH5/t7Kf5nQXBlcW/A=
    58  example.com/badchain/b v1.0.0 h1:kjDVlBxpjQavYxHE7ECCyyXhfwsfhWIqvghfRgPktSA=
    59  example.com/badchain/b v1.0.0/go.mod h1:sYsH934pMc3/A2vQZh019qrWmp4+k87l3O0VFUYqL+I=
    60  example.com/badchain/b v1.1.0 h1:iEALV+DRN62FArnYylBR4YwCALn/hCdITvhdagHa0L4=
    61  example.com/badchain/b v1.1.0/go.mod h1:mlCgKO7lRZ+ijwMFIBFRPCGt5r5oqCcHdhSSE0VL4uY=
    62  example.com/badchain/c v1.0.0 h1:lOeUHQKR7SboSH7Bj6eIDWoNHaDQXI0T2GfaH2x9fNA=
    63  example.com/badchain/c v1.0.0/go.mod h1:4U3gzno17SaQ2koSVNxITu9r60CeLSgye9y4/5LnfOE=
    64  example.com/badchain/c v1.1.0 h1:VtTg1g7fOutWKHQf+ag04KLRpdMGSfQ9s9tagVtGW14=
    65  example.com/badchain/c v1.1.0/go.mod h1:tyoJj5qh+qtb48sflwdVvk4R+OjPQEY2UJOoibsVLPk=
    66  -- use/use.go --
    67  package use
    68  
    69  import _ "example.com/badchain/c"
    70  -- testuse/testuse.go --
    71  package testuse
    72  -- testuse/testuse_test.go --
    73  package testuse
    74  
    75  import (
    76  	"testing"
    77  	_ "example.com/badchain/c"
    78  )
    79  
    80  func Test(t *testing.T) {}
    81  -- update-main-expected --
    82  go: example.com/badchain/c@v1.1.0: parsing go.mod:
    83  	module declares its path as: badchain.example.com/c
    84  	        but was required as: example.com/badchain/c
    85  	restoring example.com/badchain/c@v1.0.0
    86  -- update-a-expected --
    87  go: example.com/badchain/a@upgrade (v1.1.0) indirectly requires example.com/badchain/c@v1.1.0: parsing go.mod:
    88  	module declares its path as: badchain.example.com/c
    89  	        but was required as: example.com/badchain/c
    90  -- list-expected --
    91  go: example.com/badchain/a@v1.1.0 requires
    92  	example.com/badchain/b@v1.1.0 requires
    93  	example.com/badchain/c@v1.1.0: parsing go.mod:
    94  	module declares its path as: badchain.example.com/c
    95  	        but was required as: example.com/badchain/c
    96  -- list-missing-expected --
    97  go: finding module for package example.com/badchain/c
    98  go: found example.com/badchain/c in example.com/badchain/c v1.1.0
    99  go: m/use imports
   100  	example.com/badchain/c: example.com/badchain/c@v1.1.0: parsing go.mod:
   101  	module declares its path as: badchain.example.com/c
   102  	        but was required as: example.com/badchain/c
   103  -- list-missing-test-expected --
   104  go: finding module for package example.com/badchain/c
   105  go: found example.com/badchain/c in example.com/badchain/c v1.1.0
   106  go: m/testuse tested by
   107  	m/testuse.test imports
   108  	example.com/badchain/c: example.com/badchain/c@v1.1.0: parsing go.mod:
   109  	module declares its path as: badchain.example.com/c
   110  	        but was required as: example.com/badchain/c
   111  

View as plain text