Last active
August 29, 2015 14:15
-
-
Save freeformz/2a458cb46419e5ed223b 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 | |
# Display the packages that your code imports / depends on that | |
# are not in the go std lib. | |
result=() | |
#my deps | |
# NOTE: Requires jq | |
mine=($(go list -json | jq '.Imports + .Deps | .[]' | sort -u | sed -e 's/"//g')) | |
#stdlib | |
std=($(go list std)) | |
inlist(){ | |
item="${1}" | |
shift | |
declare -a list=("${@}") | |
for item2 in ${list[@]}; do | |
if [ "$item" == "${item2}" ]; then | |
return 0 | |
fi | |
done | |
return 1 | |
} | |
for item1 in ${mine[@]}; do | |
if ! inlist ${item1} ${std[@]} ; then | |
result+=($item1) | |
fi | |
done | |
for item in ${result[@]}; do | |
echo $item | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment