Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,10 @@ code-generator:
fmt: ## Run go fmt against code.
go fmt ./...

.PHONY: fmt-imports
fmt-imports: gci ## Run gci formatter on go files and verify.
$(GCI) write -s standard -s default -s 'prefix(sigs.k8s.io/gateway-api-inference-extension)' --skip-generated --skip-vendor .

.PHONY: fmt-verify
fmt-verify:
@out=`gofmt -w -l -d $$(find . -name '*.go')`; \
Expand Down Expand Up @@ -363,6 +367,7 @@ GOLANGCI_LINT = $(LOCALBIN)/golangci-lint
HELM = $(PROJECT_DIR)/bin/helm
YQ = $(PROJECT_DIR)/bin/yq
KUBECTL_VALIDATE = $(PROJECT_DIR)/bin/kubectl-validate
GCI = $(LOCALBIN)/gci

## Tool Versions
KUSTOMIZE_VERSION ?= v5.4.3
Expand All @@ -371,6 +376,7 @@ ENVTEST_VERSION ?= release-0.19
GOLANGCI_LINT_VERSION ?= v1.62.2
HELM_VERSION ?= v3.17.1
KUBECTL_VALIDATE_VERSION ?= v0.0.4
GCI_VERSION ?= v0.13.6

.PHONY: kustomize
kustomize: $(KUSTOMIZE) ## Download kustomize locally if necessary.
Expand Down Expand Up @@ -405,6 +411,11 @@ kubectl-validate: $(KUBECTL_VALIDATE) ## Download kubectl-validate locally if ne
$(KUBECTL_VALIDATE): $(LOCALBIN)
$(call go-install-tool,$(KUBECTL_VALIDATE),sigs.k8s.io/kubectl-validate,$(KUBECTL_VALIDATE_VERSION))

.PHONY: gci
gci: $(GCI) ## Download gci locally if necessary.
$(GCI): $(LOCALBIN)
$(call go-install-tool,$(GCI),github.com/daixiang0/gci,$(GCI_VERSION))

# go-install-tool will 'go install' any package with custom target and name of binary, if it doesn't exist
# $1 - target path with name of binary
# $2 - package url which can be installed
Expand Down