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

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

DATA=$(go list $1/... \
	| xargs -d '\n' go list -f '{{ .ImportPath }}: {{ join .Imports ", " }}' \
	| awk '{ printf "%s\n\n", $0 }' \
	)

echo "$DATA" > direct-tree.txt

DATA=$(go list $1/... \
	| xargs -d '\n' go list -f '{{ .ImportPath }}: {{ join .Deps ", " }}' \
	| awk '{ printf "%s\n\n", $0 }' \
	)

echo "$DATA" > transitive-tree.txt