github.com/fibonacci-chain/fbc@v0.0.0-20231124064014-c7636198c1e9/libs/cosmos-sdk/contrib/devtools/install-golangci-lint.sh (about) 1 #!/bin/bash 2 3 set -euo pipefail 4 5 installer="$(mktemp)" 6 trap "rm -f ${installer}" EXIT 7 8 GOBIN="${1}" 9 CURL="$(which curl)" 10 HASHSUM="${2}" 11 12 f_sha256() { 13 local l_file 14 l_file=$1 15 python -sBc "import hashlib;print(hashlib.sha256(open('$l_file','rb').read()).hexdigest())" 16 } 17 18 get_latest_release() { 19 "${CURL}" --silent "https://api.github.com/repos/$1/releases/latest" | \ 20 grep '"tag_name":' | sed -E 's/.*"([^"]+)".*/\1/' 21 } 22 23 VERSION="$(get_latest_release golangci/golangci-lint)" 24 25 echo "Downloading golangci-lint ${VERSION} installer ..." >&2 26 "${CURL}" -sfL "https://raw.githubusercontent.com/golangci/golangci-lint/${VERSION}/install.sh" > "${installer}" 27 28 echo "Checking hashsum ..." >&2 29 [ "${HASHSUM}" = "$(f_sha256 ${installer})" ] 30 chmod +x "${installer}" 31 32 echo "Launching installer ..." >&2 33 exec "${installer}" -d -b "${GOBIN}" "${VERSION}"