Skip to content

Commit a1a6dbc

Browse files
authored
pin golangci-lint version to v2.0.2 (#220)
Signed-off-by: Jonathan Dobson <[email protected]>
1 parent 9cfa8cd commit a1a6dbc

File tree

2 files changed

+12
-13
lines changed

2 files changed

+12
-13
lines changed

Diff for: Makefile

+5-7
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ BUILD_NUMBER?=unknown
4444
GO111MODULE_FLAG?=on
4545
export GO111MODULE=$(GO111MODULE_FLAG)
4646

47-
export LINT_VERSION="1.60.1"
47+
LINT_VERSION=v2.0.2
4848

4949
GOFILES=$(shell find . -type f -name '*.go' -not -path "./vendor/*")
5050

@@ -60,28 +60,26 @@ driver: deps buildimage
6060
.PHONY: deps
6161
deps:
6262
echo "Installing dependencies ..."
63-
@if ! which golangci-lint >/dev/null || [[ "$$(golangci-lint --version)" != *${LINT_VERSION}* ]]; then \
64-
go install github.com/golangci/golangci-lint/cmd/golangci-lint@v${LINT_VERSION}; \
65-
fi
63+
curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(GOPATH)/bin ${LINT_VERSION}
6664

6765
.PHONY: fmt
6866
fmt: lint
6967
gofmt -l ${GOFILES}
7068

7169
.PHONY: dofmt
72-
dofmt:
70+
dofmt: deps
7371
$(GOPATH)/bin/golangci-lint run --disable-all --enable=gofmt --fix --timeout 600s
7472

7573
.PHONY: lint
76-
lint:
74+
lint: deps
7775
hack/verify-golint.sh
7876

7977
.PHONY: build
8078
build:
8179
CGO_ENABLED=0 GOOS=$(shell go env GOOS) GOARCH=$(shell go env GOARCH) go build -mod=vendor -a -ldflags '-X main.vendorVersion='"${DRIVER_NAME}-${GIT_COMMIT_SHA}"' -extldflags "-static"' -o ${GOPATH}/bin/${EXE_DRIVER_NAME} ./cmd/
8280

8381
.PHONY: verify
84-
verify:
82+
verify: deps
8583
echo "Verifying and linting files ..."
8684
./hack/verify-all.sh
8785
echo "Congratulations! All Go source files have been linted."

Diff for: hack/verify-golint.sh

+7-6
Original file line numberDiff line numberDiff line change
@@ -15,16 +15,17 @@
1515
# limitations under the License.
1616

1717
set -euo pipefail
18-
curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(go env GOPATH)/bin latest
19-
if [[ -z "$(command -v golangci-lint)" ]]; then
20-
echo "Cannot find golangci-lint. Installing golangci-lint..."
21-
curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(go env GOPATH)/bin v1.60.1
22-
export PATH=$PATH:$(go env GOPATH)/bin
18+
19+
LINT_CMD=$(go env GOPATH)/bin/golangci-lint
20+
if [[ -z "$(command -v ${LINT_CMD})" ]]; then
21+
echo "Cannot find ${LINT_CMD}"
22+
exit 1
2323
fi
2424

2525
echo "Verifying golint"
2626
readonly PKG_ROOT="$(git rev-parse --show-toplevel)"
2727

28-
golangci-lint run --timeout=10m
28+
${LINT_CMD} version
29+
${LINT_CMD} run --timeout=10m
2930

3031
echo "Congratulations! Lint check completed for all Go source files."

0 commit comments

Comments
 (0)