summaryrefslogtreecommitdiff
path: root/dependencies/analyses/dependency-tree.sh
blob: 84085a50dee3b61d39c11a191341b0a6bef10fa8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
#!/usr/bin/bash

if test "$#" -ne 1; then
	echo "invalid arguments: usage: $0 path to package"
	exit 1
fi

go list $1/... \
	| xargs -d '\n' go list -f '{{ .ImportPath }}: {{ join .Imports ", " }}' \
	| awk '{ printf "%s\n\n", $0 }' \
	> direct-tree.tmp.$$ && mv -f direct-tree.tmp.$$ direct-tree.txt


go list $1/... \
	| xargs -d '\n' go list -f '{{ .ImportPath }}: {{ join .Deps ", " }}' \
	| awk '{ printf "%s\n\n", $0 }' \
	> transitive-tree.tmp.$$ && mv -f transitive-tree.tmp.$$ transitive-tree.txt