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.orig
    22  
    23  # Update manually. Listing modules should produce an error.
    24  go mod edit -require=example.com/badchain/a@v1.1.0
    25  ! go list -m all
    26  cmp stderr list-expected
    27  
    28  # Try listing a package that imports a package
    29  # in a module without a requirement.
    30  go mod edit -droprequire example.com/badchain/a
    31  ! go list -mod=mod m/use
    32  cmp stderr list-missing-expected
    33  
    34  ! go list -mod=mod -test m/testuse
    35  cmp stderr list-missing-test-expected
    36  
    37  -- go.mod.orig --
    38  module m
    39  
    40  go 1.13
    41  
    42  require example.com/badchain/a v1.0.0
    43  -- go.sum --
    44  example.com/badchain/a v1.0.0 h1:iJDLiHLmpQgr9Zrv+44UqywAE2IG6WkHnH4uG08vf+s=
    45  example.com/badchain/a v1.0.0/go.mod h1:6/gnCYHdVrs6mUgatUYUSbuHxEY+/yWedmTggLz23EI=
    46  example.com/badchain/a v1.1.0 h1:cPxQpsOjaIrn05yDfl4dFFgGSbjYmytLqtIIBfTsEqA=
    47  example.com/badchain/a v1.1.0/go.mod h1:T15b2BEK+RY7h7Lr2dgS38p1pgH5/t7Kf5nQXBlcW/A=
    48  example.com/badchain/b v1.0.0 h1:kjDVlBxpjQavYxHE7ECCyyXhfwsfhWIqvghfRgPktSA=
    49  example.com/badchain/b v1.0.0/go.mod h1:sYsH934pMc3/A2vQZh019qrWmp4+k87l3O0VFUYqL+I=
    50  example.com/badchain/b v1.1.0 h1:iEALV+DRN62FArnYylBR4YwCALn/hCdITvhdagHa0L4=
    51  example.com/badchain/b v1.1.0/go.mod h1:mlCgKO7lRZ+ijwMFIBFRPCGt5r5oqCcHdhSSE0VL4uY=
    52  example.com/badchain/c v1.0.0 h1:lOeUHQKR7SboSH7Bj6eIDWoNHaDQXI0T2GfaH2x9fNA=
    53  example.com/badchain/c v1.0.0/go.mod h1:4U3gzno17SaQ2koSVNxITu9r60CeLSgye9y4/5LnfOE=
    54  example.com/badchain/c v1.1.0 h1:VtTg1g7fOutWKHQf+ag04KLRpdMGSfQ9s9tagVtGW14=
    55  example.com/badchain/c v1.1.0/go.mod h1:tyoJj5qh+qtb48sflwdVvk4R+OjPQEY2UJOoibsVLPk=
    56  -- use/use.go --
    57  package use
    58  
    59  import _ "example.com/badchain/c"
    60  -- testuse/testuse.go --
    61  package testuse
    62  -- testuse/testuse_test.go --
    63  package testuse
    64  
    65  import (
    66  	"testing"
    67  	_ "example.com/badchain/c"
    68  )
    69  
    70  func Test(t *testing.T) {}
    71  -- update-main-expected --
    72  go: example.com/badchain/c@v1.1.0: parsing go.mod:
    73  	module declares its path as: badchain.example.com/c
    74  	        but was required as: example.com/badchain/c
    75  -- update-a-expected --
    76  go: example.com/badchain/a@v1.1.0 requires
    77  	example.com/badchain/b@v1.1.0 requires
    78  	example.com/badchain/c@v1.1.0: parsing go.mod:
    79  	module declares its path as: badchain.example.com/c
    80  	        but was required as: example.com/badchain/c
    81  -- list-expected --
    82  go: example.com/badchain/a@v1.1.0 requires
    83  	example.com/badchain/b@v1.1.0 requires
    84  	example.com/badchain/c@v1.1.0: parsing go.mod:
    85  	module declares its path as: badchain.example.com/c
    86  	        but was required as: example.com/badchain/c
    87  -- list-missing-expected --
    88  go: finding module for package example.com/badchain/c
    89  go: found example.com/badchain/c in example.com/badchain/c v1.1.0
    90  go: m/use imports
    91  	example.com/badchain/c: example.com/badchain/c@v1.1.0: parsing go.mod:
    92  	module declares its path as: badchain.example.com/c
    93  	        but was required as: example.com/badchain/c
    94  -- list-missing-test-expected --
    95  go: finding module for package example.com/badchain/c
    96  go: found example.com/badchain/c in example.com/badchain/c v1.1.0
    97  go: m/testuse tested by
    98  	m/testuse.test imports
    99  	example.com/badchain/c: example.com/badchain/c@v1.1.0: parsing go.mod:
   100  	module declares its path as: badchain.example.com/c
   101  	        but was required as: example.com/badchain/c
   102  

View as plain text