Skip to content

Commit

Permalink
Merge pull request #6085 from y1hao/go-min-version
Browse files Browse the repository at this point in the history
Read MIN_GO_VERSION directly with Go CLI
  • Loading branch information
karmada-bot authored Jan 26, 2025
2 parents 162cda4 + 0d9dd14 commit 96c2914
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module github.com/karmada-io/karmada

go 1.22.11 // keep in sync with .go-version and hack/util.sh
go 1.22.11 // keep in sync with .go-version

require (
github.com/adhocore/gronx v1.6.3
Expand Down
8 changes: 4 additions & 4 deletions hack/util.sh
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ KARMADA_METRICS_ADAPTER_LABEL="karmada-metrics-adapter"

KARMADA_GO_PACKAGE="github.com/karmada-io/karmada"

MIN_Go_VERSION=go1.22.11
MIN_GO_VERSION="go$(go list -m -f {{.GoVersion}})"

DEFAULT_CLUSTER_VERSION="kindest/node:v1.31.2"

Expand Down Expand Up @@ -122,10 +122,10 @@ function util::verify_docker {
function util::verify_go_version {
local go_version
IFS=" " read -ra go_version <<< "$(GOFLAGS='' go version)"
if [[ "${MIN_Go_VERSION}" != $(echo -e "${MIN_Go_VERSION}\n${go_version[2]}" | sort -s -t. -k 1,1 -k 2,2n -k 3,3n | head -n1) && "${go_version[2]}" != "devel" ]]; then
if [[ "${MIN_GO_VERSION}" != $(echo -e "${MIN_GO_VERSION}\n${go_version[2]}" | sort -s -t. -k 1,1 -k 2,2n -k 3,3n | head -n1) && "${go_version[2]}" != "devel" ]]; then
echo "Detected go version: ${go_version[*]}."
echo "Karmada requires ${MIN_Go_VERSION} or greater."
echo "Please install ${MIN_Go_VERSION} or later."
echo "Karmada requires ${MIN_GO_VERSION} or greater."
echo "Please install ${MIN_GO_VERSION} or later."
exit 1
fi
}
Expand Down

0 comments on commit 96c2914

Please sign in to comment.