Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/zoroqi/dependency-graph
Visualize Go Dependency Trees
https://github.com/zoroqi/dependency-graph
dependency-tree go golang
Last synced: 3 months ago
JSON representation
Visualize Go Dependency Trees
- Host: GitHub
- URL: https://github.com/zoroqi/dependency-graph
- Owner: zoroqi
- License: apache-2.0
- Created: 2020-06-13T03:16:01.000Z (over 4 years ago)
- Default Branch: master
- Last Pushed: 2024-01-19T07:10:40.000Z (about 1 year ago)
- Last Synced: 2024-08-02T20:44:53.944Z (6 months ago)
- Topics: dependency-tree, go, golang
- Language: Go
- Homepage:
- Size: 64.5 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- my-awesome - zoroqi/dependency-graph - tree,go,golang pushed_at:2024-01 star:0.0k fork:0.0k Visualize Go Dependency Trees (Go)
README
# dependency graph
树形打印`go mod graph`
## 安装
```
go get -v -u github.com/zoroqi/dependency-graphcd ${YOUR PROJECT PATH}
dependency-graph
```## 使用
```
-ex value
exclude package, 排除部分包, 可以多个 -ex xxx -ex yyy
-expre value
exclude package, prefix match, 排除部分包前缀匹配, 可以多个 -expre xxx -expre yyy
-l int
max level 最大打印深度
-list
filter the package in the 'list -m all' result, 基于 `list -m all` 进行过滤
-p string
default: tree print
rl: reverse line print
rt: reverse tree print
wt: whole tree print
dot: graphviz print, `xxx | dot -Tsvg -o test.svg`
-s string
search pkg name, 检索特定的包
```打印
* default
```
a
|-b
| |-c
|-d
|-e
```
* rl
```
c -> b -> a
e -> d -> a
```
* rt
```
c
|-b
|-ae
|-d
|-a
```
* wt
```
a
|-b
|-ca
|-d
|-e
```
* dot
```
digraph godeps {
0 [label="a" style="filled"]
1 [label="b" style="filled"]
0 -> 1
}
```## 一些新知识
`go mod graph` 可以查看依赖关系
`go list -m all` 查看准确依赖版本, 并不完全准确.
`go list -m -u -json all` 依赖详细信息
`go mod why -m all` 查看依赖路径
`go mod why -m github.com/xxx/xxx` 指定package依赖路径
`incompatible`代表包没有按照golang的规范进行版本管理 [挺好的文档](https://github.com/RainbowMango/GoExpertProgramming)
```
github.com/xxx/[email protected] 就是不规范的
github.com/xxx/xxx/[email protected] 就是合规的
github.com/xxx/[email protected] 就是合规的
```[测试项目snake](https://github.com/1024casts/snake), 代码不多依赖不少. 特别声明, 尽量设置打印层数.