Skip to content

Commit fcb09c1

Browse files
jkhelilcursoragent
andcommitted
fix(SRVKP-11820): align lint with CI and drop unused consts
Fix two issues found during agentic workflow setup: - Makefile: add version check so local golangci-lint binary is reinstalled when it diverges from the version in ci.yaml (v2.7.2); add PKG variable to lint-go for fast single-package iteration - Remove unused resourceKind constants in tektonchain, tektonpipeline, and tektontrigger reconcilers that caused lint failures locally Signed-off-by: Jawed khelil <jkhelil@redhat.com> Assisted-by: Claude Sonnet 4.6 (via Cursor) Co-authored-by: Cursor <cursoragent@cursor.com>
1 parent 6888701 commit fcb09c1

4 files changed

Lines changed: 11 additions & 12 deletions

File tree

Makefile

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,11 @@ $(BIN)/controller-gen: | $(BIN) ; $(info $(M) getting controller-gen)
4848

4949
GOLANGCILINT = $(or ${GOLANGCILINT_BIN},${GOLANGCILINT_BIN},$(BIN)/golangci-lint)
5050
$(BIN)/golangci-lint: | $(BIN) ; $(info $(M) getting golangci-lint $(GOLANGCI_VERSION))
51-
@curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(BIN) $(GOLANGCI_VERSION)
51+
@if [ -f $(BIN)/golangci-lint ] && $(BIN)/golangci-lint --version 2>/dev/null | grep -qF "$(GOLANGCI_VERSION)"; then \
52+
echo "golangci-lint $(GOLANGCI_VERSION) already installed"; \
53+
else \
54+
curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(BIN) $(GOLANGCI_VERSION); \
55+
fi
5256

5357
##@ Clean
5458
.PHONY: clean-cluster
@@ -205,13 +209,14 @@ test-unit: ## Run unit tests
205209
.PHONY: lint
206210
lint: lint-go lint-yaml ## run all linters
207211

212+
PKG ?= ./...
208213
.PHONY: lint-go
209-
lint-go: | $(GOLANGCILINT) ## runs go linter on all go files
214+
lint-go: | $(GOLANGCILINT) ## runs go linter; set PKG=./some/pkg/... to lint a single package
210215
@echo "Linting go files..."
211-
@$(GOLANGCILINT) run ./... --modules-download-mode=vendor \
212-
--max-issues-per-linter=0 \
213-
--max-same-issues=0 \
214-
--timeout 5m
216+
@$(GOLANGCILINT) run $(PKG) --modules-download-mode=vendor \
217+
--max-issues-per-linter=0 \
218+
--max-same-issues=0 \
219+
--timeout 5m
215220

216221
YAML_FILES := $(shell find . -type f -regex ".*y[a]ml" -print)
217222
.PHONY: lint-yaml

pkg/reconciler/kubernetes/tektonchain/tektonchain.go

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,8 +46,6 @@ import (
4646
)
4747

4848
const (
49-
resourceKind = v1alpha1.KindTektonChain
50-
5149
// Chains ConfigMap
5250
ChainsConfig = "chains-config"
5351
// Chains Container Name

pkg/reconciler/kubernetes/tektonpipeline/reconcile.go

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,6 @@ import (
3232
)
3333

3434
const (
35-
resourceKind = v1alpha1.KindTektonPipeline
36-
3735
proxyLabel = "operator.tekton.dev/disable-proxy=true"
3836
)
3937

pkg/reconciler/kubernetes/tektontrigger/reconcile.go

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,6 @@ import (
3434
pkgreconciler "knative.dev/pkg/reconciler"
3535
)
3636

37-
const resourceKind = v1alpha1.KindTektonTrigger
38-
3937
// Reconciler implements controller.Reconciler for TektonTrigger resources.
4038
type Reconciler struct {
4139
// kube client to interact with core k8s resources

0 commit comments

Comments
 (0)