File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -128,6 +128,23 @@ make vet # Vet the Go code
128128make golangci-lint # Verify the Go code
129129```
130130
131+ ### Targeted lint/format
132+
133+ For quick feedback on specific files or packages instead of running project-wide ` make ` targets:
134+
135+ ``` bash
136+ # Go
137+ make golangci-lint LINT_PKG=./pkg/controller/... # Lint a single Go package
138+ go vet ./pkg/controller/... # Vet a single Go package (package-level)
139+ gofmt -w path/to/file.go # Format a single Go file
140+
141+ # Python
142+ pre-commit run --files path/to/file.py # Run all hooks on a single file
143+
144+ # Rust (crate-level: triggers on the file but formats/checks the entire crate)
145+ pre-commit run --files path/to/file.rs # Run all hooks on a single file
146+ ```
147+
131148** Code generation** (always run after modifying the APIs):
132149
133150``` bash
Original file line number Diff line number Diff line change @@ -43,6 +43,7 @@ HELM_DOCS ?= $(LOCALBIN)/helm-docs
4343YQ ?= $(LOCALBIN ) /yq
4444GOLANGCI_LINT ?= $(LOCALBIN ) /golangci-lint
4545GOLANGCI_LINT_KAL ?= $(LOCALBIN ) /golangci-lint-kube-api-linter
46+ LINT_PKG ?= ./...
4647KUBE_LINTER ?= $(LOCALBIN ) /kube-linter
4748
4849# #@ General
@@ -173,7 +174,7 @@ vet: ## Run go vet against the code.
173174
174175.PHONY : golangci-lint
175176golangci-lint : golangci-lint-install golangci-lint-kal # # Run golangci-lint to verify Go files.
176- $(GOLANGCI_LINT ) run --timeout 5m ./...
177+ $(GOLANGCI_LINT ) run --timeout 5m $( LINT_PKG )
177178 $(GOLANGCI_LINT_KAL ) run -v --config $(PROJECT_DIR ) /.golangci-kal.yml
178179
179180# Instructions to run tests.
You can’t perform that action at this time.
0 commit comments