summaryrefslogtreecommitdiff
path: root/dependencies/analyses/dependency-tree.sh
diff options
context:
space:
mode:
Diffstat (limited to 'dependencies/analyses/dependency-tree.sh')
-rwxr-xr-xdependencies/analyses/dependency-tree.sh17
1 files changed, 17 insertions, 0 deletions
diff --git a/dependencies/analyses/dependency-tree.sh b/dependencies/analyses/dependency-tree.sh
new file mode 100755
index 000000000..84085a50d
--- /dev/null
+++ b/dependencies/analyses/dependency-tree.sh
@@ -0,0 +1,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