Skip to content

Instantly share code, notes, and snippets.

@wadey
Created August 25, 2015 18:15
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save wadey/57a704777cd7ddf36f4d to your computer and use it in GitHub Desktop.
Save wadey/57a704777cd7ddf36f4d to your computer and use it in GitHub Desktop.
godeps
#!/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