1 2 3 4 5 6 7 8 9 10 11 12 13
#!/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"