1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253 |
- LOGS=logs
- COVER=$(LOGS)/cover.out
- COMMAND=fizzbuzz
- # Assumes the most common case of a single-component GOPATH.
- BINDIR := $(shell go env GOPATH)/bin
- .PHONY: all
- all: clean deps build
- .PHONY: build
- build: lint test
- go get ./...
- go mod tidy
- go build ./cmd/$(COMMAND)
- .PHONY: clean
- clean:
- # Adding -modcache is counter-productive in most cases as it is global
- go clean -i -r -x -cache -fuzzcache -testcache | cut -c1-150
- rm -fr logs/*
- rm -f $(COMMAND) $(BINDIR)/$(COMMAND)
- .PHONY: cover
- cover: deps
- go test -covermode=atomic -coverprofile=$(COVER) ./...
- go tool cover -html=$(COVER)
- gocoverstats -f $(COVER) -v -percent
- .PHONY: deps
- deps:
- go install gitlab.com/fgmarand/gocoverstats@latest
- go install github.com/fgm/envrun@latest
- go install honnef.co/go/tools/cmd/staticcheck@latest
- .PHONY: fuzz
- fuzz:
- go test -fuzz=FuzzFizzBuzz -v -fuzztime=10s ./domain
- .PHONY: install
- install: deps build
- go install ./cmd/$(COMMAND)
- .PHONY: lint
- lint:
- staticcheck -checks=all ./...
- .PHONY: serve
- serve: install
- envrun -f .env $(COMMAND) -v -base=fb
- .PHONY: test
- test: lint
- go test -race ./...
|