Created
August 25, 2015 18:15
-
-
Save wadey/57a704777cd7ddf36f4d to your computer and use it in GitHub Desktop.
godeps
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/zsh | |
typeset -A DONE | |
_dep() { | |
go list -f "{{if not .Standard}}{{printf \"\t%q -> %q;\n\" \"$1\" .ImportPath}}{{end}}" "$2" | |
} | |
_graph() { | |
if [ -z ${DONE[$1]} ] | |
then | |
DONE[$1]="done" | |
for d in $(go list -f '{{if not .Standard}}{{join .Imports " "}}{{end}}' "$1") | |
do | |
_dep "$1" "$d" | |
_graph "$d" | |
done | |
fi | |
} | |
echo "digraph G {" | |
_graph "$1" | |
echo "}" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment