Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cmd/go: mod graph output as tree #46456

Closed
vitaly-zdanevich opened this issue May 30, 2021 · 4 comments
Closed

cmd/go: mod graph output as tree #46456

vitaly-zdanevich opened this issue May 30, 2021 · 4 comments
Labels
FeatureRequest FrozenDueToAge GoCommand cmd/go modules NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.

Comments

@vitaly-zdanevich
Copy link
Contributor

What version of Go are you using (go version)?

$ go version
1.16

Current output:

google.golang.org/genproto@v0.0.0-20191108220845-16a3f7862a1a github.com/golang/protobuf@v1.3.2
google.golang.org/genproto@v0.0.0-20191108220845-16a3f7862a1a golang.org/x/exp@v0.0.0-20190121172915-509febef88a4
google.golang.org/genproto@v0.0.0-20191108220845-16a3f7862a1a golang.org/x/lint@v0.0.0-20190227174305-5b3e6a55c961
google.golang.org/genproto@v0.0.0-20191108220845-16a3f7862a1a golang.org/x/tools@v0.0.0-20190226205152-f727befe758c
google.golang.org/genproto@v0.0.0-20191108220845-16a3f7862a1a google.golang.org/grpc@v1.19.0
google.golang.org/genproto@v0.0.0-20191108220845-16a3f7862a1a honnef.co/go/tools@v0.0.0-20190102054323-c2f93a96b099
golang.org/x/tools@v0.0.0-20191115202509-3a792d9c32b2 github.com/yuin/goldmark@v1.3.5
golang.org/x/tools@v0.0.0-20191115202509-3a792d9c32b2 golang.org/x/mod@v0.4.2
golang.org/x/tools@v0.0.0-20191115202509-3a792d9c32b2 golang.org/x/net@v0.0.0-20210405180319-a5a99cb37ef4
golang.org/x/tools@v0.0.0-20191115202509-3a792d9c32b2 golang.org/x/sync@v0.0.0-20210220032951-036812b2e83c
golang.org/x/tools@v0.0.0-20191115202509-3a792d9c32b2 golang.org/x/sys@v0.0.0-20210510120138-977fb7262007
golang.org/x/tools@v0.0.0-20191115202509-3a792d9c32b2 golang.org/x/xerrors@v0.0.0-20200804184101-5ec99f83aff1
google.golang.org/genproto@v0.0.0-20191115194625-c23dd37a84c9 github.com/golang/protobuf@v1.3.2
google.golang.org/genproto@v0.0.0-20191115194625-c23dd37a84c9 golang.org/x/exp@v0.0.0-20190121172915-509febef88a4
google.golang.org/genproto@v0.0.0-20191115194625-c23dd37a84c9 golang.org/x/lint@v0.0.0-20190227174305-5b3e6a55c961
google.golang.org/genproto@v0.0.0-20191115194625-c23dd37a84c9 golang.org/x/tools@v0.0.0-20190226205152-f727befe758c
google.golang.org/genproto@v0.0.0-20191115194625-c23dd37a84c9 google.golang.org/grpc@v1.19.0
github.com/kr/text@v0.1.0 github.com/kr/pty@v1.1.1
honnef.co/go/tools@v0.0.1-2019.2.3 github.com/BurntSushi/toml@v0.3.1
honnef.co/go/tools@v0.0.1-2020.1.3 golang.org/x/tools@v0.0.0-20191130070609-6e064ea0cf2d
honnef.co/go/tools@v0.0.1-2020.1.3 golang.org/x/mod@v0.0.0-20190513183733-4bf6d317e70e
honnef.co/go/tools@v0.0.1-2020.1.3 github.com/rogpeppe/go-internal@v1.3.0
honnef.co/go/tools@v0.0.1-2020.1.3 github.com/kisielk/gotool@v1.0.0
honnef.co/go/tools@v0.0.1-2020.1.3 github.com/google/renameio@v0.1.0
honnef.co/go/tools@v0.0.1-2020.1.3 github.com/BurntSushi/toml@v0.3.1
honnef.co/go/tools@v0.0.1-2019.2.3 golang.org/x/tools@v0.0.0-20190621195816-6e04913cbbac
honnef.co/go/tools@v0.0.1-2019.2.3 golang.org/x/mod@v0.0.0-20190513183733-4bf6d317e70e
honnef.co/go/tools@v0.0.1-2019.2.3 github.com/rogpeppe/go-internal@v1.3.0
honnef.co/go/tools@v0.0.1-2019.2.3 github.com/kisielk/gotool@v1.0.0
honnef.co/go/tools@v0.0.1-2019.2.3 github.com/google/renameio@v0.1.0
rsc.io/quote/v3@v3.1.0 rsc.io/sampler@v1.3.0
rsc.io/sampler@v1.3.0 golang.org/x/text@v0.0.0-20170915032832-14c0d48ead0c

Expected like from tree command:

│   ├── vscode-go.article
│   ├── waza-talk.article
│   ├── why-generics.article
│   ├── wire.article
│   └── wrap.go
├── CONTRIBUTING.md
├── CONTRIBUTORS
├── go.mod
├── go.sum
├── LICENSE
├── local.go
├── local_test.go
├── PATENTS
├── README.md
├── rewrite.go
├── _static
│   ├── favicon.ico
│   ├── fonts
│   │   ├── Go-BoldItalic.woff
│   │   ├── Go-Bold.woff
│   │   ├── Go-Italic.woff
│   │   ├── GoMedium-Italic.woff
│   │   ├── GoMedium.woff
│   │   ├── GoMono-BoldItalic.woff
│   │   ├── GoMono-Bold.woff
│   │   ├── GoMono-Italic.woff
│   │   ├── GoMono.woff
│   │   └── GoRegular.woff
│   └── fonts.css
└── _template
    ├── article.tmpl
    ├── doc.tmpl
    ├── home.tmpl
    ├── index.tmpl
    └── root.tmpl
@seankhliao
Copy link
Member

how are diamond dependencies represented in a tree?

@vitaly-zdanevich
Copy link
Contributor Author

Sorry, render diamonds - it will be easier to understand. Maybe under feature flag.

@seankhliao seankhliao changed the title go mod graph: render: from list to tree cmd/go: mod graph output as tree May 30, 2021
@seankhliao
Copy link
Member

I think this is better covered by external tooling, go mod graph exports the necessary data for other tools to display them according to user preferences, ex:

@seankhliao seankhliao added the NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. label May 30, 2021
@jayconrod
Copy link
Contributor

+1 to @seankhliao's comment.

For even moderately sized go.mod files, the module dependency graph can be quite large: difficult to visualize in the terminal. There may be diamonds, cycles, and "spirals". There may be many versions of the same module.

This is best handled with external tooling.

@golang golang locked and limited conversation to collaborators Jun 1, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
FeatureRequest FrozenDueToAge GoCommand cmd/go modules NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Projects
None yet
Development

No branches or pull requests

4 participants