summaryrefslogtreecommitdiff
path: root/hack/lib
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
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')
-rwxr-xr-xhack/lib/golang.sh23
-rwxr-xr-xhack/lib/install.sh19
2 files changed, 22 insertions, 20 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
diff --git a/hack/lib/install.sh b/hack/lib/install.sh
index 1861f887e..81baa4238 100755
--- a/hack/lib/install.sh
+++ b/hack/lib/install.sh
@@ -77,25 +77,6 @@ function install_golangci-lint {
export PATH=$PATH:$GOPATH/bin
}
-verify_go_version(){
- if [[ -z "$(command -v go)" ]]; then
- echo "Can't find 'go' in PATH, please fix and retry.
-See http://golang.org/doc/install for installation instructions."
- exit 1
- fi
-
- local go_version
- IFS=" " read -ra go_version <<< "$(go version)"
- local minimum_go_version
- minimum_go_version=go1.12.1
- if [[ "${minimum_go_version}" != $(echo -e "${minimum_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[*]}.
-Kubernetes requires ${minimum_go_version} or greater.
-Please install ${minimum_go_version} or later."
- exit 1
- fi
-}
-
verify_docker_installed(){
# verify the docker installed
command -v docker >/dev/null || {