Last active
January 17, 2018 22:58
-
-
Save arya/c297b58170169fad09c3b3c63da8feef 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 -o errexit -o nounset -o pipefail | |
package=$1 | |
package_dir=$(go list -f '{{.Dir}}' ${package}) | |
pushd ${package_dir} > /dev/null | |
git_root=$(git rev-parse --show-toplevel) | |
pushd ${git_root} > /dev/null | |
dep_packages=$(go list -f '{{join .Deps "\n"}}' ${package} | xargs go list -f '{{if not .Standard}}{{.Dir}}{{end}}') | |
repo_packages="" | |
for dep in ${dep_packages}; do | |
if [[ "${dep}" == "${git_root}/"* ]]; then | |
repo_packages+="${dep} " | |
fi | |
done | |
echo ${repo_packages} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment