-
Notifications
You must be signed in to change notification settings - Fork 2
/
Makefile
53 lines (39 loc) · 1.14 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
VERSION := $(shell git describe --tags --always --dirty="-dev")
LDFLAGS := -ldflags='-X "main.version=$(VERSION)"'
GOTESTFLAGS = -race
GOTAGS = testing
GO ?= $(shell which go)
export GOEXPERIMENT=nocoverageredesign
.PHONY: test
test: compose
$(GO) test -vet=off -tags='$(GOTAGS)' $(GOTESTFLAGS) -coverpkg="./..." -coverprofile=.coverprofile ./...
grep -v 'cmd' < .coverprofile > .covprof && mv .covprof .coverprofile
$(GO) tool cover -func=.coverprofile
.PHONY: coverage
coverage:
$(GO) tool cover -html=.coverprofile
.PHONY: version
version:
@echo $(VERSION)
.PHONY: dist
dist:
goreleaser release --config .goreleaser.public.yaml --clean --snapshot
.PHONY: compose
compose:
docker compose up -d
.PHONY: lint
lint: $(GOPATH)/bin/golangci-lint
golangci-lint run --timeout 5m ./...
$(GOPATH)/bin/golangci-lint:
$(GO) install github.com/golangci/golangci-lint/cmd/[email protected]
$(GOPATH)/bin/golines:
$(GO) install github.com/segmentio/golines@latest
.PHONY: fmtcheck
fmtcheck: $(GOPATH)/bin/golines
exit $(shell golines -m 128 -l . | wc -l)
.PHONY: fmtfix
fmtfix: $(GOPATH)/bin/golines
golines -m 128 -w .
.PHONY: clean
clean:
rm -rf dist