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

     1  # Verifies golang.org/issue/47738.
     2  
     3  # In this test, the user has rewritten their imports to use rsc.io/quote/v3,
     4  # but their go.mod still requires rsc.io/quote@v1.5.2, and they indirectly
     5  # require rsc.io/quote@v1.5.1 but don't import anything from it.
     6  go list -m -f '{{.Path}}@{{.Version}}{{if .Indirect}} indirect{{end}}' all
     7  stdout '^rsc.io/quote@v1.5.2$'
     8  ! stdout 'rsc.io/quote/v3'
     9  go list -e all
    10  ! stdout '^rsc.io/quote$'
    11  
    12  # 'go mod tidy' should preserve the requirement on rsc.io/quote but mark it
    13  # indirect. This prevents a downgrade to v1.5.1, which could introduce
    14  # an ambiguity.
    15  go mod tidy
    16  go list -m -f '{{.Path}}@{{.Version}}{{if .Indirect}} indirect{{end}}' all
    17  stdout '^rsc.io/quote@v1.5.2 indirect$'
    18  stdout '^rsc.io/quote/v3@v3.0.0$'
    19  
    20  -- go.mod --
    21  module use
    22  
    23  go 1.16
    24  
    25  require (
    26  	old-indirect v0.0.0
    27  	rsc.io/quote v1.5.2
    28  )
    29  
    30  replace old-indirect v0.0.0 => ./old-indirect
    31  -- go.sum --
    32  golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c h1:pvCbr/wm8HzDD3fVywevekufpn6tCGPY3spdHeZJEsw=
    33  golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
    34  rsc.io/quote v1.5.1/go.mod h1:LzX7hefJvL54yjefDEDHNONDjII0t9xZLPXsUe+TKr0=
    35  rsc.io/quote v1.5.2 h1:3fEykkD9k7lYzXqCYrwGAf7iNhbk4yCjHmKBN9td4L0=
    36  rsc.io/quote v1.5.2/go.mod h1:LzX7hefJvL54yjefDEDHNONDjII0t9xZLPXsUe+TKr0=
    37  rsc.io/sampler v1.3.0 h1:HLGR/BgEtI3r0uymSP/nl2uPLsUnNJX8toRyhfpBTII=
    38  rsc.io/sampler v1.3.0/go.mod h1:T1hPZKmBbMNahiBKFy5HrXp6adAjACjK9JXDnKaTXpA=
    39  -- use.go --
    40  package use
    41  
    42  import (
    43  	_ "old-indirect/empty"
    44  
    45  	_ "rsc.io/quote/v3"
    46  )
    47  -- old-indirect/empty/empty.go --
    48  package empty
    49  -- old-indirect/go.mod --
    50  module old-indirect
    51  
    52  go 1.16
    53  
    54  require rsc.io/quote v1.5.1
    55  -- old-indirect/go.sum --
    56  golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
    57  rsc.io/quote v1.5.2/go.mod h1:LzX7hefJvL54yjefDEDHNONDjII0t9xZLPXsUe+TKr0=
    58  rsc.io/sampler v1.3.0/go.mod h1:T1hPZKmBbMNahiBKFy5HrXp6adAjACjK9JXDnKaTXpA=
    59  

View as plain text