Skip to content

Instantly share code, notes, and snippets.

@DavidNix
Created July 8, 2022 16:37
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 DavidNix/26c9e86b7941225ec6576d2a858983bf to your computer and use it in GitHub Desktop.
Save DavidNix/26c9e86b7941225ec6576d2a858983bf to your computer and use it in GitHub Desktop.
Find Cosmos Go Versions
#!/usr/bin/env bash
# Quick and dirty script to get sense of Go versions for Cosmos chains.
# Must be run at root of chain registry: git clone https://github.com/cosmos/chain-registry.git
REPOS=$(cat $(find . -name "chain.json") | jq '.codebase.git_repo')
results=""
for repo in $REPOS
do
project=$(echo $repo | awk -F'/' '{printf "%s/%s", $4, $5}' | tr -d '"')
version=$(curl -Ls "https://raw.githubusercontent.com/$project/main/go.mod" | grep "^go 1\.")
if [ -z "$version" ]
then
# try master branch
version=$(curl -Ls "https://raw.githubusercontent.com/$project/master/go.mod" | grep "^go 1\.")
fi
if [ -z "$version" ]
then
# failed to find version
version="go unknown"
fi
result="$version $project"
echo $result
results+="$result"
results+=$'\n'
done
echo
echo "Groups"
echo "$results" | awk '{arr[$2]++}END{for (a in arr) print a, arr[a]}'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment