Skip to content
This repository was archived by the owner on Jul 30, 2021. It is now read-only.

Commit b66af43

Browse files
authored
Merge pull request #948 from wking/gofmt-with-git
Makefile: Drop hard-coded Bash and simplify gofmt
2 parents 5339918 + 9815a94 commit b66af43

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

Makefile

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,8 @@ export CGO_ENABLED:=0
22
export GOARCH:=amd64
33
export PATH:=$(PATH):$(PWD)
44

5-
SHELL:=$(shell which bash)
65
LOCAL_OS:=$(shell uname | tr A-Z a-z)
7-
GOFILES:=$(shell find . -name '*.go' | grep -v -E '(./vendor)')
6+
GOFILES:=$(shell find . -name '*.go' ! -path './vendor/*')
87
LDFLAGS=-X github.com/kubernetes-incubator/bootkube/pkg/version.Version=$(shell $(CURDIR)/build/git-version.sh)
98
TERRAFORM:=$(shell command -v terraform 2> /dev/null)
109

@@ -28,8 +27,7 @@ release: \
2827
check \
2928
_output/release/bootkube.tar.gz \
3029

31-
check:
32-
@gofmt -l -s $(GOFILES) | read; if [ $$? == 0 ]; then gofmt -s -d $(GOFILES); exit 1; fi
30+
check: gofmt
3331
ifdef TERRAFORM
3432
$(TERRAFORM) fmt -check ; if [ ! $$? -eq 0 ]; then exit 1; fi
3533
else
@@ -39,6 +37,10 @@ endif
3937
@./scripts/verify-gopkg.sh
4038
@go test -v $(shell go list ./... | grep -v '/vendor/\|/e2e')
4139

40+
gofmt:
41+
gofmt -s -w $(GOFILES)
42+
git diff --exit-code
43+
4244
install:
4345
go install -ldflags "$(LDFLAGS)" ./cmd/bootkube
4446

@@ -84,4 +86,4 @@ vendor:
8486
clean:
8587
rm -rf _output
8688

87-
.PHONY: all check clean install release vendor
89+
.PHONY: all check clean gofmt install release vendor

0 commit comments

Comments
 (0)