Skip to content

Commit

Permalink
improved makefile
Browse files Browse the repository at this point in the history
  • Loading branch information
caarlos0 committed Sep 9, 2017
1 parent a5bc8ea commit 4415049
Showing 1 changed file with 40 additions and 6 deletions.
46 changes: 40 additions & 6 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,3 +1,42 @@
SOURCE_FILES?=$$(go list ./... | grep -v /vendor/)
TEST_PATTERN?=.
TEST_OPTIONS?=

setup:
go get -u github.com/alecthomas/gometalinter
go get -u github.com/golang/dep/...
go get -u github.com/pierrre/gotestcover
go get -u golang.org/x/tools/cmd/cover
dep ensure
gometalinter --install --update

test:
gotestcover $(TEST_OPTIONS) -covermode=count -coverprofile=coverage.out $(SOURCE_FILES) -run $(TEST_PATTERN) -timeout=30s

cover: test
go tool cover -html=coverage.out

fmt:
find . -name '*.go' -not -wholename './vendor/*' | while read -r file; do gofmt -w -s "$$file"; goimports -w "$$file"; done

lint:
gometalinter --vendor --disable-all \
--enable=deadcode \
--enable=ineffassign \
--enable=gosimple \
--enable=staticcheck \
--enable=gofmt \
--enable=goimports \
--enable=dupl \
--enable=misspell \
--enable=errcheck \
--enable=vet \
--enable=vetshadow \
--deadline=10m \
./...

ci: lint test

docker-build:
docker build -t caarlos0/domain_exporter .

Expand All @@ -6,9 +45,4 @@ docker-push:

docker: docker-build docker-push

test:
go test -v ./...

setup:
go get -u github.com/golang/dep/cmd/dep
dep ensure -v
.DEFAULT_GOAL := build

0 comments on commit 4415049

Please sign in to comment.