diff options
| author | gy95 <guoyao17@huawei.com> | 2021-09-08 11:43:46 +0800 |
|---|---|---|
| committer | gy95 <guoyao17@huawei.com> | 2021-09-08 12:11:24 +0800 |
| commit | e6d13a43e191cb96a7ae30055a96df378c2ed271 (patch) | |
| tree | 5054423fa911636b16b753549bb1cb5b86f50897 /hack/lib/install.sh | |
| parent | Merge pull request #3132 from subpathdev/errorMsg (diff) | |
| download | kubeedge-e6d13a43e191cb96a7ae30055a96df378c2ed271.tar.gz | |
update golangci-lint version to v1.42.0
Signed-off-by: gy95 <guoyao17@huawei.com>
Diffstat (limited to 'hack/lib/install.sh')
| -rwxr-xr-x | hack/lib/install.sh | 22 |
1 files changed, 17 insertions, 5 deletions
diff --git a/hack/lib/install.sh b/hack/lib/install.sh index 494d7bc0f..7d56b0213 100755 --- a/hack/lib/install.sh +++ b/hack/lib/install.sh @@ -50,19 +50,31 @@ function check_kind { # check if golangci-lint installed function check_golangci-lint { echo "checking golangci-lint" + export PATH=$PATH:$GOPATH/bin + expectedVersion="1.42.0" command -v golangci-lint >/dev/null 2>&1 if [[ $? -ne 0 ]]; then - echo "installing golangci-lint ." - curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(go env GOPATH)/bin v1.30.0 + install_golangci-lint + else + version=$(golangci-lint version) + if [[ $version =~ $expectedVersion ]]; then + echo -n "found golangci-lint, version: " && golangci-lint version + else + echo "golangci-lint version not matched, now version is $version, begin to install new version $expectedVersion" + install_golangci-lint + fi + fi +} + +function install_golangci-lint { + echo "installing golangci-lint ." + curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(go env GOPATH)/bin v1.42.0 if [[ $? -ne 0 ]]; then echo "golangci-lint installed failed, exiting." exit 1 fi export PATH=$PATH:$GOPATH/bin - else - echo -n "found golangci-lint, version: " && golangci-lint version - fi } verify_go_version(){ |
