Created
July 25, 2018 13:43
-
-
Save tomwilkie/4cc0e3e526c553e18bbe23dd2ee838c9 to your computer and use it in GitHub Desktop.
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/bash | |
set -e | |
declare -A cache | |
f() { | |
local pkg=$2 | |
local ident=$1 | |
echo "$ident$pkg" | |
echo $pkg | grep -v testing >/dev/null | |
if [ "${cache[$pkg]}" = "done" ]; then | |
return | |
fi | |
cache[$pkg]=done | |
if echo $pkg | grep -v cortex >/dev/null; then | |
return | |
fi | |
local deps=$(go list -f '{{ .Imports }}' $pkg) | |
deps=${deps#"["} | |
deps=${deps%"]"} | |
for dep in $deps; do | |
f "$ident " $dep | |
done | |
} | |
f "" $1 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment