Skip to content

Commit 0669bfd

Browse files
committed
update format-go-code syntax
Signed-off-by: Xavier Coulon <xcoulon@redhat.com>
1 parent 6267eab commit 0669bfd

2 files changed

Lines changed: 4 additions & 11 deletions

File tree

make/generate.mk

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,6 @@ API_GROUPNAME=toolchain
33
API_FULL_GROUPNAME=toolchain.dev.openshift.com
44
API_VERSION:=v1alpha1
55

6-
## Location to install dependencies to
7-
LOCALBIN ?= $(shell pwd)/bin
8-
$(LOCALBIN):
9-
mkdir -p $(LOCALBIN)
10-
11-
126
## Tool Binaries
137
CONTROLLER_GEN ?= $(LOCALBIN)/controller-gen
148
OPENAPI_GEN ?= $(LOCALBIN)/openapi-gen
@@ -50,10 +44,6 @@ $(OPENAPI_GEN): ## install openapi-gen locally if necessary.
5044
$(CRD_REF_DOCS): ## install crd-ref-docs locally if necessary.
5145
GOBIN=$(LOCALBIN) $(GO) install github.com/elastic/crd-ref-docs@latest
5246

53-
.PHONY: manifests
54-
manifests: $(CONTROLLER_GEN) ## Generate WebhookConfiguration, ClusterRole and CustomResourceDefinition objects.
55-
$(CONTROLLER_GEN) rbac:roleName=manager-role crd webhook paths="./api/..." output:crd:artifacts:config=config/crd/bases
56-
5747
.PHONY: generate
5848
generate: generate-object generate-crd gen-crd-ref-docs generate-openapi dispatch-crds ## Generate code containing DeepCopy, DeepCopyInto, and DeepCopyObject method implementations.
5949

make/go.mk

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,10 @@ GOFORMAT_FILES := $(shell find . -name '*.go' | grep -vEf ./make/gofmt_exclude)
1313
.PHONY: format-go-code
1414
## Formats any go file that does not match formatting defined by gofmt
1515
format-go-code:
16-
$(Q)gofmt -s -l -w ${GOFORMAT_FILES}
16+
# The + tells find to batch multiple found files into a single gofmt invocation (like xargs),
17+
# which is much faster than the alternative \;, which runs gofmt once per file. Removing it
18+
# would be a syntax error — find -exec requires either + or \; as a terminator.
19+
$(Q)find . -name '*.go' -not -path '*/vendor/*' -not -path '*/.git/*' -exec gofmt -s -l -w {} +
1720

1821
.PHONY: build
1922
## Build

0 commit comments

Comments
 (0)