Skip to content

Commit 247cc03

Browse files
committed
Install goimports into hack/tools
On-behalf-of: SAP [email protected] Signed-off-by: Robert Vasek <[email protected]>
1 parent ae7f42f commit 247cc03

File tree

2 files changed

+9
-2
lines changed

2 files changed

+9
-2
lines changed

Makefile

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,10 @@ GOLANGCI_LINT_VER := v1.62.2
5454
GOLANGCI_LINT_BIN := golangci-lint
5555
GOLANGCI_LINT := $(TOOLS_GOBIN_DIR)/$(GOLANGCI_LINT_BIN)-$(GOLANGCI_LINT_VER)
5656

57+
GOIMPORTS_VER := v0.31.0
58+
GOIMPORTS_BIN := goimports
59+
GOIMPORTS := $(TOOLS_GOBIN_DIR)/$(GOIMPORTS_BIN)-$(GOIMPORTS_VER)
60+
5761
HTTEST_VER := v0.3.2
5862
HTTEST_BIN := httest
5963
HTTEST := $(TOOLS_GOBIN_DIR)/$(HTTEST_BIN)-$(HTTEST_VER)
@@ -135,6 +139,9 @@ install: require-jq require-go require-git verify-go-versions ## Install the pro
135139
$(GOLANGCI_LINT):
136140
GOBIN=$(TOOLS_GOBIN_DIR) $(GO_INSTALL) github.com/golangci/golangci-lint/cmd/golangci-lint $(GOLANGCI_LINT_BIN) $(GOLANGCI_LINT_VER)
137141

142+
$(GOIMPORTS):
143+
GOBIN=$(TOOLS_GOBIN_DIR) $(GO_INSTALL) golang.org/x/tools/cmd/goimports $(GOIMPORTS_BIN) $(GOIMPORTS_VER)
144+
138145
$(HTTEST):
139146
GOBIN=$(TOOLS_GOBIN_DIR) $(GO_INSTALL) go.xrstf.de/httest $(HTTEST_BIN) $(HTTEST_VER)
140147

@@ -185,7 +192,7 @@ vendor: ## Vendor the dependencies
185192
go mod vendor
186193
.PHONY: vendor
187194

188-
tools: $(GOLANGCI_LINT) $(HTTEST) $(CONTROLLER_GEN) $(KCP_APIGEN_GEN) $(YAML_PATCH) $(GOTESTSUM) $(CODE_GENERATOR) ## Install tools
195+
tools: $(GOLANGCI_LINT) $(GOIMPORTS) $(HTTEST) $(CONTROLLER_GEN) $(KCP_APIGEN_GEN) $(YAML_PATCH) $(GOTESTSUM) $(CODE_GENERATOR) ## Install tools
189196
.PHONY: tools
190197

191198
$(CONTROLLER_GEN):

hack/gen-patch-defaultrestmapper.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ for sym in ${symbols_from_meta_pkg[@]}; do
9797
gofmt -w -r "${sym} -> meta.${sym}" "${DEFAULTRESTMAPPER_PATCH_FILEPATH}"
9898
done
9999

100-
goimports -w "${DEFAULTRESTMAPPER_PATCH_FILEPATH}"
100+
"${REPO_ROOT}/hack/tools/goimports" -w "${DEFAULTRESTMAPPER_PATCH_FILEPATH}"
101101

102102
# Inform the caller if there were changes. Something could have broken.
103103

0 commit comments

Comments
 (0)