Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Read MIN_GO_VERSION directly with Go CLI #6085

Merged
merged 1 commit into from
Jan 26, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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