From 9a0224b67df1662d4a439b8bc10833f20a7b41e8 Mon Sep 17 00:00:00 2001 From: "F. Eugene Aumson" Date: Wed, 4 Sep 2024 21:28:18 +0000 Subject: [PATCH] versions.sh: pull versions from go.mod again addresses review comment https://github.com/ava-labs/awm-relayer/pull/408#discussion_r1734772198 --- scripts/versions.sh | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/scripts/versions.sh b/scripts/versions.sh index 018f5d67..3ebc5469 100755 --- a/scripts/versions.sh +++ b/scripts/versions.sh @@ -13,18 +13,25 @@ function getDepVersion() { grep -m1 "^\s*$1" $BASE_PATH/go.mod | cut -d ' ' -f2 } +extract_commit() { + local version=$1 + if [[ $version == *-* ]]; then + # Extract the substring after the last '-' + version=${version##*-} + fi + echo "$version" +} + # This needs to be exported to be picked up by the dockerfile. export GO_VERSION=${GO_VERSION:-$(getDepVersion go)} # Don't export them as they're used in the context of other calls # TODO: undo this hack once go.mod is referring to a tag rather than a commit -#AVALANCHEGO_VERSION=${AVALANCHEGO_VERSION:-$(getDepVersion github.com/ava-labs/avalanchego)} -AVALANCHEGO_VERSION=${AVALANCHEGO_VERSION:-ab83fb41528de93c1790301cdd67a07dda9299f0} +AVALANCHEGO_VERSION=${AVALANCHEGO_VERSION:-$(extract_commit $(getDepVersion github.com/ava-labs/avalanchego))} GINKGO_VERSION=${GINKGO_VERSION:-$(getDepVersion github.com/onsi/ginkgo/v2)} # TODO: undo this hack once go.mod is referring to a tag rather than a commit -#SUBNET_EVM_VERSION=${SUBNET_EVM_VERSION:-$(getDepVersion github.com/ava-labs/subnet-evm)} -SUBNET_EVM_VERSION=${SUBNET_EVM_VERSION:-18633729a0cde7d695616e14b77873957a2b59c2} +SUBNET_EVM_VERSION=${SUBNET_EVM_VERSION:-$(extract_commit $(getDepVersion github.com/ava-labs/subnet-evm))} # Set golangci-lint version GOLANGCI_LINT_VERSION=${GOLANGCI_LINT_VERSION:-'v1.60'}