Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions .custom-gcl.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
version: v2.6.2
name: golangci-lint
destination: ./bin
plugins:
- module: 'sigs.k8s.io/kube-api-linter'
version: 'v0.0.0-20251112164541-d94382a24f06'
10 changes: 4 additions & 6 deletions .github/workflows/golangci-lint.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,7 @@ jobs:
with:
go-version: "1.25.x"
cache: false
- name: lint
# v8.0.0
uses: golangci/golangci-lint-action@4afd733a84b1f43292c63897423277bb7f4313a9
with:
version: v2.4.0
args: --timeout=5m
- name: Build custom golangci-lint
run: make golangci-lint
- name: Run lint
run: make lint
10 changes: 7 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ KUSTOMIZE_VERSION ?= v5.5.0
CONTROLLER_TOOLS_VERSION ?= v0.18.0
# ENVTEST_VERSION ?= latest # ref. https://github.com/kubernetes-sigs/controller-runtime/tree/main/tools/setup-envtest
ENVTEST_VERSION ?= release-0.19
GOLANGCI_LINT_VERSION ?= v2.4.0
GOLANGCI_LINT_VERSION ?= v2.6.2
# ENVTEST_K8S_VERSION refers to the version of kubebuilder assets to be downloaded by envtest binary.
ENVTEST_K8S_VERSION = 1.31.0

Expand All @@ -212,9 +212,13 @@ $(ENVTEST): $(LOCALBIN)
$(call go-install-tool,$(ENVTEST),sigs.k8s.io/controller-runtime/tools/setup-envtest,$(ENVTEST_VERSION))

.PHONY: golangci-lint
golangci-lint: $(GOLANGCI_LINT) ## Download golangci-lint locally if necessary.
golangci-lint: $(GOLANGCI_LINT) ## Build golangci-lint with kube-api-linter plugin.
$(GOLANGCI_LINT): $(LOCALBIN)
$(call go-install-tool,$(GOLANGCI_LINT),github.com/golangci/golangci-lint/v2/cmd/golangci-lint,$(GOLANGCI_LINT_VERSION))
@if [ ! -f "$(GOLANGCI_LINT)" ]; then \
echo "Building golangci-lint with custom plugins..." ;\
GOBIN=$(LOCALBIN) go install github.com/golangci/golangci-lint/v2/cmd/golangci-lint@$(GOLANGCI_LINT_VERSION) ;\
$(LOCALBIN)/golangci-lint custom ;\
fi

# go-install-tool will 'go install' any package with custom target and name of binary, if it doesn't exist
# $1 - target path with name of binary
Expand Down