Skip to content

Commit

Permalink
Merge pull request kubernetes-retired#948 from wking/gofmt-with-git
Browse files Browse the repository at this point in the history
Makefile: Drop hard-coded Bash and simplify gofmt
  • Loading branch information
aaronlevy authored Aug 16, 2018
2 parents 5339918 + 9815a94 commit b66af43
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,8 @@ export CGO_ENABLED:=0
export GOARCH:=amd64
export PATH:=$(PATH):$(PWD)

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

Expand All @@ -28,8 +27,7 @@ release: \
check \
_output/release/bootkube.tar.gz \

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

gofmt:
gofmt -s -w $(GOFILES)
git diff --exit-code

install:
go install -ldflags "$(LDFLAGS)" ./cmd/bootkube

Expand Down Expand Up @@ -84,4 +86,4 @@ vendor:
clean:
rm -rf _output

.PHONY: all check clean install release vendor
.PHONY: all check clean gofmt install release vendor

0 comments on commit b66af43

Please sign in to comment.