From 7c8ee78eaf69106beac78d9bf69e5034cfff8f9d Mon Sep 17 00:00:00 2001 From: Ian Campbell Date: Mon, 10 Dec 2018 13:17:14 +0000 Subject: [PATCH] build: Add a `fmt` target which runs `gofmt` on all files. Signed-off-by: Ian Campbell --- Makefile | 4 ++++ docker.Makefile | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/Makefile b/Makefile index 51b168dcaa..5e4fad15b4 100644 --- a/Makefile +++ b/Makefile @@ -21,6 +21,10 @@ test: test-unit ## run tests test-coverage: ## run test coverage ./scripts/test/unit-with-coverage $(shell go list ./... | grep -vE '/vendor/|/e2e/') +.PHONY: fmt +fmt: + go list -f {{.Dir}} ./... | xargs gofmt -w -s -d + .PHONY: lint lint: ## run all the lint tools gometalinter --config gometalinter.json ./... diff --git a/docker.Makefile b/docker.Makefile index 2ff2594a7f..d9923c890e 100644 --- a/docker.Makefile +++ b/docker.Makefile @@ -81,6 +81,10 @@ shell: dev ## alias for dev lint: build_linter_image ## run linters docker run -ti $(ENVVARS) $(MOUNTS) $(LINTER_IMAGE_NAME) +.PHONY: fmt +fmt: + docker run --rm $(ENVVARS) $(MOUNTS) $(DEV_DOCKER_IMAGE_NAME) make fmt + .PHONY: vendor vendor: build_docker_image vendor.conf ## download dependencies (vendor/) listed in vendor.conf docker run -ti --rm $(ENVVARS) $(MOUNTS) $(DEV_DOCKER_IMAGE_NAME) make vendor