Skip to content

Instantly share code, notes, and snippets.

@anthonydahanne
Created May 15, 2023 21:06
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 anthonydahanne/7abc41640d22c335d00a28ef1ab03e46 to your computer and use it in GitHub Desktop.
Save anthonydahanne/7abc41640d22c335d00a28ef1ab03e46 to your computer and use it in GitHub Desktop.
# from https://stackoverflow.com/a/67638584/24069
# read each item in the JSON array to an item in the Bash array
set +x
readarray -t my_array < <(jq --raw-output '.[]' $1)
# iterate through the Bash array
for item in "${my_array[@]}"; do
git clone git@github.com:$item.git &>/dev/null
cd ${item#*/}
go test -v ./... -coverprofile=coverage.out &>/dev/null
echo "$item: $(go tool cover -func=coverage.out | tail -n 1 | awk '{print $NF}')"
cd ..
rm -rf ${item#*/}
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment