From 0e655a61b13709ddee92b327c9bbea88fd6760fb Mon Sep 17 00:00:00 2001 From: r-vasquez Date: Thu, 14 Nov 2024 14:37:58 -0800 Subject: [PATCH] rpk/makefile: download golangcilint with recommended method Downloading using go get is not recommended per golangci-lint docs --- src/go/rpk/Makefile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/go/rpk/Makefile b/src/go/rpk/Makefile index cf5657890ec6..d9d6575418e7 100644 --- a/src/go/rpk/Makefile +++ b/src/go/rpk/Makefile @@ -23,6 +23,7 @@ endif GOOS ?= $(shell go env GOOS) GOARCH ?= $(shell go env GOARCH) +GOPATH ?= $(shell go env GOPATH) OUTDIR := $(GOOS)-$(GOARCH) REV := $(shell git rev-parse --short HEAD) @@ -64,8 +65,7 @@ run_gofumpt: $(GOFUMPT_OS_CMD) install_golangci_lint: - @echo "installing golangci-lint" - @$(GOCMD) install github.com/golangci/golangci-lint/cmd/golangci-lint@latest + @which $(GOLANGCILINTCMD) || (if [ $$? -eq 1 ]; then echo "golangci-lint not found, installing..."; curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(GOPATH)/bin v1.62.0; fi) run_linter: $(GOLANGCILINTCMD) run