build: Add a `fmt` target which runs `gofmt` on all files.

Signed-off-by: Ian Campbell <ijc@docker.com>
(cherry picked from commit 7c8ee78eaf)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
This commit is contained in:
Ian Campbell 2018-12-10 13:17:14 +00:00 committed by Sebastiaan van Stijn
parent 206ea57da8
commit db7875928c
No known key found for this signature in database
GPG Key ID: 76698F39D527CE8C
2 changed files with 8 additions and 0 deletions

View File

@ -21,6 +21,10 @@ test: test-unit ## run tests
test-coverage: ## run test coverage test-coverage: ## run test coverage
./scripts/test/unit-with-coverage $(shell go list ./... | grep -vE '/vendor/|/e2e/') ./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 .PHONY: lint
lint: ## run all the lint tools lint: ## run all the lint tools
gometalinter --config gometalinter.json ./... gometalinter --config gometalinter.json ./...

View File

@ -86,6 +86,10 @@ shell: dev ## alias for dev
lint: build_linter_image ## run linters lint: build_linter_image ## run linters
docker run -ti $(ENVVARS) $(MOUNTS) $(LINTER_IMAGE_NAME) docker run -ti $(ENVVARS) $(MOUNTS) $(LINTER_IMAGE_NAME)
.PHONY: fmt
fmt:
docker run --rm $(ENVVARS) $(MOUNTS) $(DEV_DOCKER_IMAGE_NAME) make fmt
.PHONY: vendor .PHONY: vendor
vendor: build_docker_image vendor.conf ## download dependencies (vendor/) listed in vendor.conf 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 docker run -ti --rm $(ENVVARS) $(MOUNTS) $(DEV_DOCKER_IMAGE_NAME) make vendor