cloudflare/pint
Publicmirrored from https://github.com/cloudflare/pintAvailable
Makefile
48lines · modecode
| 1 | PINT_BIN := pint |
| 2 | PINT_GO_DIRS := cmd internal |
| 3 | PINT_SRC := $(shell find $(PINT_GO_DIRS) -type f -name '*.go') |
| 4 | |
| 5 | GOBIN := $(shell go env GOBIN) |
| 6 | ifeq ($(GOBIN),) |
| 7 | GOBIN = $(shell go env GOPATH)/bin |
| 8 | endif |
| 9 | |
| 10 | COVER_DIR = .cover |
| 11 | COVER_PROFILE = $(COVER_DIR)/coverage.out |
| 12 | |
| 13 | .PHONY: build |
| 14 | build: $(PINT_BIN) |
| 15 | |
| 16 | $(PINT_BIN): $(PINT_SRC) go.mod go.sum |
| 17 | go build ./cmd/pint |
| 18 | |
| 19 | $(GOBIN)/golangci-lint: tools/golangci-lint/go.mod tools/golangci-lint/go.sum |
| 20 | go install -modfile=tools/golangci-lint/go.mod github.com/golangci/golangci-lint/cmd/golangci-lint |
| 21 | .PHONY: lint |
| 22 | lint: $(GOBIN)/golangci-lint |
| 23 | $(GOBIN)/golangci-lint run -E revive,staticcheck,misspell |
| 24 | |
| 25 | .PHONY: test |
| 26 | test: |
| 27 | mkdir -p $(COVER_DIR) |
| 28 | echo 'mode: atomic' > $(COVER_PROFILE) |
| 29 | go test \ |
| 30 | -covermode=atomic \ |
| 31 | -coverprofile=$(COVER_PROFILE) \ |
| 32 | -coverpkg=./... \ |
| 33 | -race \ |
| 34 | -count=5 \ |
| 35 | -timeout=5m \ |
| 36 | ./... |
| 37 | |
| 38 | .PHONY: cover |
| 39 | cover: test |
| 40 | go tool cover -func=$(COVER_PROFILE) |
| 41 | |
| 42 | .PHONY: coverhtml |
| 43 | coverhtml: test |
| 44 | ifndef CI |
| 45 | go tool cover -html=$(COVER_PROFILE) |
| 46 | else |
| 47 | go tool cover -html=$(COVER_PROFILE) -o=.cover/all.html |
| 48 | endif |
| 49 | |