Skip to content

Instantly share code, notes, and snippets.

@tomwilkie
Created July 25, 2018 13:43
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 tomwilkie/4cc0e3e526c553e18bbe23dd2ee838c9 to your computer and use it in GitHub Desktop.
Save tomwilkie/4cc0e3e526c553e18bbe23dd2ee838c9 to your computer and use it in GitHub Desktop.
#!/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