Created
July 8, 2022 16:37
-
-
Save DavidNix/26c9e86b7941225ec6576d2a858983bf to your computer and use it in GitHub Desktop.
Find Cosmos Go Versions
This file contains hidden or 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
#!/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