diff --git a/.custom-gcl.yaml b/.custom-gcl.yaml index afbb2f623..6f0028874 100644 --- a/.custom-gcl.yaml +++ b/.custom-gcl.yaml @@ -1,6 +1,9 @@ -version: v2.4.0 -name: golangci-lint-kube-api-linter +version: v2.5.0 +name: golangci-lint-custom destination: ./bin plugins: - module: 'sigs.k8s.io/kube-api-linter' version: v0.0.0-20250819121536-a575e84f4ce8 + - module: "go.uber.org/nilaway" + import: "go.uber.org/nilaway/cmd/gclplugin" + version: "v0.0.0-20250821055425-361559d802f0" diff --git a/.golangci-nilaway.yml b/.golangci-nilaway.yml new file mode 100644 index 000000000..12de6f138 --- /dev/null +++ b/.golangci-nilaway.yml @@ -0,0 +1,23 @@ +version: "2" +run: + issues-exit-code: 1 +output: + formats: + text: + path: stdout +linters: + default: none + enable: + - nilaway + settings: + custom: + nilaway: + type: "module" + description: Static analysis tool to detect potential nil panics in Go code. + settings: + include-pkgs: "" + exclude-file-docstrings: ignore_autogenerated +issues: + max-issues-per-linter: 0 + max-same-issues: 0 + new: false diff --git a/Makefile b/Makefile index fcf8d91ee..db136bc42 100644 --- a/Makefile +++ b/Makefile @@ -131,12 +131,12 @@ lint: ## Run lint against code. $(GOLANGCI_LINT) run -c .golangci.yml .PHONY: lint -lint-api: golangci-lint-kal ## Run lint against code. - $(GOLANGCI_LINT_KAL) run -c .golangci-kal.yml +lint-api: golangci-lint-custom ## Run lint against code. + $(GOLANGCI_LINT_CUSTOM) run -c .golangci-kal.yml .PHONY: nilcheck -nilcheck: nilaway ## Run nil check against code. - go list ./... | xargs -I {} -d '\n' nilaway -include-pkgs {} -exclude-file-docstrings "ignore_autogenerated" ./... +nilcheck: golangci-lint-custom ## Run nil check against code. + $(GOLANGCI_LINT_CUSTOM) run -c .golangci-nilaway.yml .PHONY: vulncheck vulncheck: govulncheck ## Run vulnerability check against code. @@ -358,7 +358,7 @@ GOVULNC ?= $(LOCALBIN)/govulncheck MOCKGEN ?= $(LOCALBIN)/mockgen GOWRAP ?= $(CACHE_BIN)/gowrap GOLANGCI_LINT ?= $(LOCALBIN)/golangci-lint -GOLANGCI_LINT_KAL ?= $(CACHE_BIN)/golangci-lint-kube-api-linter +GOLANGCI_LINT_CUSTOM ?= $(CACHE_BIN)/golangci-lint-custom S5CMD ?= $(CACHE_BIN)/s5cmd ## Tool Versions @@ -458,9 +458,9 @@ golangci-lint: $(GOLANGCI_LINT) $(GOLANGCI_LINT): # Build golangci-lint from tools folder. GOBIN=$(LOCALBIN) go install github.com/golangci/golangci-lint/v2/cmd/golangci-lint@$(GOLANGCI_LINT_VERSION) -.phony: golangci-lint-kal -golangci-lint-kal: $(GOLANGCI_LINT_KAL) -$(GOLANGCI_LINT_KAL): $(GOLANGCI_LINT) # Build golangci-lint-kal from custom configuration. +.phony: golangci-lint-custom +golangci-lint-custom: $(GOLANGCI_LINT_CUSTOM) +$(GOLANGCI_LINT_CUSTOM): $(GOLANGCI_LINT) # Build golangci-lint-custom from custom configuration. $(GOLANGCI_LINT) custom .PHONY: nilaway