summaryrefslogtreecommitdiff
path: root/hack/lib/golang.sh
diff options
context:
space:
mode:
authorfisherxu <xufei40@huawei.com>2022-01-13 19:28:55 +0800
committerfisherxu <xufei40@huawei.com>2022-01-17 18:13:24 +0800
commit97a52cdb3070b9f02a74bc0992c543923af0dda0 (patch)
tree23fecd7d1706d81d7ee80d3fab82ff6d91d72c26 /hack/lib/golang.sh
parentMerge pull request #3467 from gy95/release (diff)
downloadkubeedge-97a52cdb3070b9f02a74bc0992c543923af0dda0.tar.gz
verify go version when call build.sh script
Signed-off-by: fisherxu <xufei40@huawei.com>
Diffstat (limited to 'hack/lib/golang.sh')
-rwxr-xr-xhack/lib/golang.sh23
1 files changed, 22 insertions, 1 deletions
diff --git a/hack/lib/golang.sh b/hack/lib/golang.sh
index 27eb89a51..eaee5d42b 100755
--- a/hack/lib/golang.sh
+++ b/hack/lib/golang.sh
@@ -26,6 +26,27 @@ set -o pipefail
YES="y"
NO="n"
+kubeedge::golang::verify_golang_version() {
+ echo "go detail version: $(go version)"
+
+ goversion=$(go version |awk -F ' ' '{printf $3}' |sed 's/go//g')
+
+ echo "go version: $goversion"
+
+ X=$(echo $goversion|awk -F '.' '{printf $1}')
+ Y=$(echo $goversion|awk -F '.' '{printf $2}')
+
+ if [ $X -lt 1 ] ; then
+ echo "go major version must >= 1, now is $X"
+ exit 1
+ fi
+
+ if [ $Y -lt 16 ] ; then
+ echo "go minor version must >= 16, now is $Y"
+ exit 1
+ fi
+}
+
kubeedge::version::get_version_info() {
GIT_COMMIT=$(git rev-parse "HEAD^{commit}" 2>/dev/null)
@@ -269,7 +290,7 @@ kubeedge::golang::cross_build_place_binaries() {
mkdir -p ${KUBEEDGE_OUTPUT_BINPATH}
for bin in ${binaries[@]}; do
- echo "cross buildding $bin GOARM${goarm}"
+ echo "cross building $bin GOARM${goarm}"
local name="${bin##*/}"
if [ "${goarm}" == "8" ]; then
set -x