1# Targets: 2# 3# all: Builds the code locally after testing 4# 5# fmt: Formats the source files 6# build: Builds the code locally 7# vet: Vets the code 8# lint: Runs lint over the code (you do not need to fix everything) 9# test: Runs the tests 10# cover: Gives you the URL to a nice test coverage report 11# 12# install: Builds, tests and installs the code locally 13 14.PHONY: all fmt build vet lint test cover install 15 16# The first target is always the default action if `make` is called without 17# args we build and install into $GOPATH so that it can just be run 18 19all: fmt vet test install 20 21fmt: 22 @gofmt -s -w ./$* 23 24build: 25 @go build 26 27vet: 28 @go vet *.go 29 30lint: 31 @golint *.go 32 33test: 34 @go test -v ./... 35 36cover: COVERAGE_FILE := coverage.out 37cover: 38 @go test -coverprofile=$(COVERAGE_FILE) && \ 39 cover -html=$(COVERAGE_FILE) && rm $(COVERAGE_FILE) 40 41install: 42 @go install ./... 43