You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In a tidy pruned module (with go 1.17 or higher in go.mod), edit an indirect dependency down to a lower version without changing direct dependencies that require it. This makes go.mod inconsistent: go list -m all will show an error, and go -list -m -mod=mod all will show the original build list and will fix go.mod.
In this state, go mod why -m falsely reports that the main module does not depend on the downgraded module.
# This command works correctly.
go mod why -m rsc.io/sampler
# Downgrade indirect dependency without changing direct dependent.
go mod edit -require=rsc.io/[email protected]
# This command says nothing uses rsc.io/sampler
go mod why -m rsc.io/sampler
-- go.mod --
module use
go 1.17
require rsc.io/quote v1.5.2
require (
golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c // indirect
rsc.io/sampler v1.3.0 // indirect
)
-- go.sum --
golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c h1:qgOY6WgZOaTkIIMiVjBQcw93ERBE4m30iBm00nkL0i8=
golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
rsc.io/quote v1.5.2 h1:w5fcysjrx7yqtD/aO+QwRjYZOKnaM9Uh2b40tElTs3Y=
rsc.io/quote v1.5.2/go.mod h1:LzX7hefJvL54yjefDEDHNONDjII0t9xZLPXsUe+TKr0=
rsc.io/sampler v1.3.0 h1:7uVkIFmeBqHfdjD+gZwtXXI+RODJ2Wc4O7MPEh/QiW4=
rsc.io/sampler v1.3.0/go.mod h1:T1hPZKmBbMNahiBKFy5HrXp6adAjACjK9JXDnKaTXpA=
-- use.go --
package use
import _ "rsc.io/quote"
What did you expect to see?
go mod why -m rsc.io/sampler should report the correct import chain in either case.
What did you see instead?
# rsc.io/sampler
(main module does not need module rsc.io/sampler)
The text was updated successfully, but these errors were encountered:
What version of Go are you using (
go version
)?Does this issue reproduce with the latest release?
yes
What operating system and processor architecture are you using (
go env
)?go env
OutputWhat did you do?
In a tidy pruned module (with
go 1.17
or higher in go.mod), edit an indirect dependency down to a lower version without changing direct dependencies that require it. This makes go.mod inconsistent:go list -m all
will show an error, andgo -list -m -mod=mod all
will show the original build list and will fix go.mod.In this state,
go mod why -m
falsely reports that the main module does not depend on the downgraded module.What did you expect to see?
go mod why -m rsc.io/sampler
should report the correct import chain in either case.What did you see instead?
The text was updated successfully, but these errors were encountered: