From decde97a91083cdbd71691be402a3d7ae92c3d13 Mon Sep 17 00:00:00 2001 From: hongming Date: Thu, 9 Feb 2023 12:08:16 +0800 Subject: [PATCH] chore: Bump golangci-lint to v1.51.1 (#5511) --- .golangci.yaml | 17 - hack/lib/golang.sh | 2 +- hack/tools/Makefile | 53 --- hack/tools/README.md | 3 - hack/tools/go.mod | 213 +++++++++- hack/tools/go.sum | 745 ++++++++++++++++++++++++----------- hack/verify-all.sh | 1 - hack/verify-golangci-lint.sh | 19 +- 8 files changed, 722 insertions(+), 331 deletions(-) delete mode 100644 .golangci.yaml delete mode 100644 hack/tools/Makefile diff --git a/.golangci.yaml b/.golangci.yaml deleted file mode 100644 index 59028ee24..000000000 --- a/.golangci.yaml +++ /dev/null @@ -1,17 +0,0 @@ -run: - timeout: 30m - skip-dirs: - - pkg/client -linters: - # Disable all linters. - # Default: false - disable-all: true - # Enable specific linter - # https://golangci-lint.run/usage/linters/#enabled-by-default-linters - enable: - - deadcode - - unused - - varcheck - - ineffassign - - staticcheck - - gosimple diff --git a/hack/lib/golang.sh b/hack/lib/golang.sh index a89908f13..290534aaf 100755 --- a/hack/lib/golang.sh +++ b/hack/lib/golang.sh @@ -16,7 +16,7 @@ EOF local go_version IFS=" " read -ra go_version <<< "$(go version)" local minimum_go_version - minimum_go_version=go1.12.1 + minimum_go_version=go1.19 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 kube::log::usage_from_stdin </dev/null || true) diff --git a/hack/verify-golangci-lint.sh b/hack/verify-golangci-lint.sh index 35b129e42..75542d70a 100755 --- a/hack/verify-golangci-lint.sh +++ b/hack/verify-golangci-lint.sh @@ -39,7 +39,7 @@ if ! command -v golangci-lint ; then # Install golangci-lint echo 'installing golangci-lint ' pushd "${KUBE_ROOT}/hack/tools" >/dev/null - GO111MODULE=auto go install -mod= github.com/golangci/golangci-lint/cmd/golangci-lint@v1.44.2 + GO111MODULE=auto go install -mod=mod github.com/golangci/golangci-lint/cmd/golangci-lint@v1.51.1 popd >/dev/null fi @@ -48,29 +48,20 @@ cd "${KUBE_ROOT}" function error_exit { if [ $? -eq 1 ]; then echo "Please run the following command:" - echo " make golint" + echo "make golint" fi } trap "error_exit" EXIT -# Show only new issues created after git revision rev -rev="${REV:-origin/master}" -if [ -n "${PULL_BASE_REF}" ];then - echo "prow pull ref: ${PULL_BASE_REF}" - rev=origin/${PULL_BASE_REF} -fi - -echo "running golangci-lint: REV=${rev} " +echo "running golangci-lint: REV=HEAD^ " golangci-lint run \ --timeout 30m \ --disable-all \ - -E deadcode \ -E unused \ - -E varcheck \ -E ineffassign \ -E staticcheck \ -E gosimple \ -E bodyclose \ --skip-dirs pkg/client \ - --new-from-rev="${rev}" \ - pkg/... cmd/... tools/... test/... kube/... + --new-from-rev=HEAD^ \ + pkg/... cmd/... test/... kube/...