diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 23e437bd..3cda39af 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -31,6 +31,12 @@ repos: entry: make args: ['crd-schema-check'] pass_filenames: false + - id: make-style-check + name: make-style-check + language: system + entry: make + args: ['style-check'] + pass_filenames: false - repo: https://github.com/pre-commit/pre-commit-hooks rev: v4.4.0 diff --git a/Makefile b/Makefile index eee11b73..2b35d69b 100644 --- a/Makefile +++ b/Makefile @@ -127,6 +127,10 @@ vet: gowork ## Run go vet against code. go vet ./... go vet ./... ./api/... +.PHONY: style-check +style-check: ## Run go modernize to check latest style conventions + go run golang.org/x/tools/gopls/internal/analysis/modernize/cmd/modernize@latest -fix -test ./... + .PHONY: tidy tidy: ## Run go mod tidy on every mod file in the repo go mod tidy