mirror of
https://github.com/kubernetes-sigs/node-feature-discovery.git
synced 2024-12-14 11:57:51 +00:00
Makefile: add gofmt and gofmt-verify targets
For re-formatting the code and checking that we comply. Inspired by what we have in node-feature-discovery-operator.
This commit is contained in:
parent
1465da4cdc
commit
447eee261d
1 changed files with 12 additions and 0 deletions
12
Makefile
12
Makefile
|
@ -2,6 +2,7 @@
|
|||
.FORCE:
|
||||
|
||||
GO_CMD := go
|
||||
GO_FMT := gofmt
|
||||
|
||||
IMAGE_BUILD_CMD := docker build
|
||||
IMAGE_BUILD_EXTRA_OPTS :=
|
||||
|
@ -44,6 +45,17 @@ mock:
|
|||
mockery --name=APIHelpers --dir=pkg/apihelper --inpkg --note="Re-generate by running 'make mock'"
|
||||
mockery --name=LabelerClient --dir=pkg/labeler --inpkg --note="Re-generate by running 'make mock'"
|
||||
|
||||
gofmt:
|
||||
@$(GO_FMT) -w -l $$(find . -name '*.go')
|
||||
|
||||
gofmt-verify:
|
||||
@out=`$(GO_FMT) -l -d $$(find . -name '*.go')`; \
|
||||
if [ -n "$$out" ]; then \
|
||||
echo "$$out"; \
|
||||
exit 1; \
|
||||
fi
|
||||
|
||||
|
||||
test:
|
||||
$(GO_CMD) test ./cmd/... ./pkg/...
|
||||
|
||||
|
|
Loading…
Reference in a new issue