1
0
Fork 0
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:
Markus Lehtonen 2020-05-19 14:19:18 +03:00
parent 1465da4cdc
commit 447eee261d

View file

@ -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/...