Install golangci-lint binary instead of from source

Signed-off-by: RainbowMango <qdurenhongcai@gmail.com>
This commit is contained in:
RainbowMango 2023-03-14 19:51:14 +08:00
parent 3670705964
commit 52a2727bef
1 changed files with 8 additions and 2 deletions

View File

@ -5,13 +5,19 @@ set -o nounset
set -o pipefail
REPO_ROOT=$(dirname "${BASH_SOURCE[0]}")/..
GOLANGCI_LINT_PKG="github.com/golangci/golangci-lint/cmd/golangci-lint"
GOLANGCI_LINT_VER="v1.49.0"
cd "${REPO_ROOT}"
source "hack/util.sh"
util::install_tools ${GOLANGCI_LINT_PKG} ${GOLANGCI_LINT_VER}
if util::cmd_exist golangci-lint ; then
echo "Using golangci-lint version:"
golangci-lint version
else
echo "Installing golangci-lint ${GOLANGCI_LINT_VER}"
# https://golangci-lint.run/usage/install/#other-ci
curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(go env GOPATH)/bin ${GOLANGCI_LINT_VER}
fi
if golangci-lint run; then
echo 'Congratulations! All Go source files have passed staticcheck.'