Skip to content

Commit 8d8769e

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 e4eaabd commit 8d8769e

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
@@ -44,7 +44,11 @@ $(BIN)/kustomize: | $(BIN) ; $(info $(M) getting kustomize)
4444

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

4953
##@ Clean
5054
.PHONY: clean-cluster
@@ -192,13 +196,14 @@ test-unit: ## Run unit tests
192196
.PHONY: lint
193197
lint: lint-go lint-yaml ## run all linters
194198

199+
PKG ?= ./...
195200
.PHONY: lint-go
196-
lint-go: | $(GOLANGCILINT) ## runs go linter on all go files
201+
lint-go: | $(GOLANGCILINT) ## runs go linter; set PKG=./some/pkg/... to lint a single package
197202
@echo "Linting go files..."
198-
@$(GOLANGCILINT) run ./... --modules-download-mode=vendor \
199-
--max-issues-per-linter=0 \
200-
--max-same-issues=0 \
201-
--timeout 5m
203+
@$(GOLANGCILINT) run $(PKG) --modules-download-mode=vendor \
204+
--max-issues-per-linter=0 \
205+
--max-same-issues=0 \
206+
--timeout 5m
202207

203208
YAML_FILES := $(shell find . -type f -regex ".*y[a]ml" -print)
204209
.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)