Skip to content

Commit

Permalink
upgrade golangci-lint
Browse files Browse the repository at this point in the history
Signed-off-by: spacewander <[email protected]>
  • Loading branch information
spacewander committed Feb 15, 2024
1 parent e408538 commit e9e40d0
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 5 deletions.
15 changes: 11 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -51,15 +51,19 @@ ifeq ($(IN_CI), true)
MOUNT_GOMOD_CACHE =
endif

# For some tools, like golangci-lint, we prefer to use the latest version so that we can have the new feature.
# For the other tools, like kind, we don't upgrade it until there is a strong reason.

LOCALBIN ?= $(shell pwd)/bin
# Remember to remove tools downloaded into bin directory manually before updating them.
# If they need to be updated frequently, we can consider to store them in the `Dockerfile.dev`.
$(LOCALBIN):
@mkdir -p $(LOCALBIN)

GO_FMTTER_VERSION = 0.3.8
.PHONY: install-go-fmtter
install-go-fmtter: $(LOCALBIN)
test -x $(LOCALBIN)/gosimports || GOBIN=$(LOCALBIN) go install github.com/rinchsan/gosimports/cmd/[email protected]
if ! test -x $(LOCALBIN)/gosimports || ! $(LOCALBIN)/gosimports -version | grep $(GO_FMTTER_VERSION) >/dev/null; then \
GOBIN=$(LOCALBIN) go install github.com/rinchsan/gosimports/cmd/gosimports@v$(GO_FMTTER_VERSION); \
fi

.PHONY: gen-proto
gen-proto: dev-tools install-go-fmtter $(GO_TARGETS)
Expand Down Expand Up @@ -152,9 +156,12 @@ build-dev-tools-local:

# For lint-go/fmt-go: we don't cover examples/dev_your_plugin which is just an example

GOLANGCI_LINT_VERSION = 1.56.1
.PHONY: lint-go
lint-go:
test -x $(LOCALBIN)/golangci-lint || GOBIN=$(LOCALBIN) go install github.com/golangci/golangci-lint/cmd/[email protected]
if ! test -x $(LOCALBIN)/golangci-lint || ! $(LOCALBIN)/golangci-lint --version | grep $(GOLANGCI_LINT_VERSION) >/dev/null; then \
GOBIN=$(LOCALBIN) go install github.com/golangci/golangci-lint/cmd/golangci-lint@v$(GOLANGCI_LINT_VERSION); \
fi
$(LOCALBIN)/golangci-lint run --config=.golangci.yml

.PHONY: fmt-go
Expand Down
2 changes: 1 addition & 1 deletion controller/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ undeploy: ## Undeploy controller from the K8s cluster specified in ~/.kube/confi

## Location to install dependencies to
LOCALBIN ?= $(shell pwd)/bin
# Remember to remove tools downloaded into bin directory manually before updating them.
# Remember to remove tools downloaded into bin directory manually before updating them.
# If they need to be updated frequently, we can consider to store them in the `Dockerfile.dev`.
$(LOCALBIN):
mkdir -p $(LOCALBIN)
Expand Down

0 comments on commit e9e40d0

Please sign in to comment.