forked from nats-io/prometheus-nats-exporter
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
70 lines (61 loc) · 1.66 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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
export GO111MODULE := on
drepo ?= natsio
prometheus-nats-exporter.docker:
CGO_ENABLED=0 GOOS=linux go build -o $@ -v -a \
-tags netgo -tags timetzdata \
-installsuffix netgo -ldflags "-s -w"
.PHONY: dockerx
dockerx:
ifneq ($(ver),)
# Ensure 'docker buildx ls' shows correct platforms.
docker buildx build \
--tag $(drepo)/prometheus-nats-exporter:$(ver) --tag $(drepo)/prometheus-nats-exporter:latest \
--platform linux/amd64,linux/arm/v6,linux/arm/v7,linux/arm64/v8 \
--file docker/linux/Dockerfile \
--push .
else
# Missing version, try this.
# make dockerx ver=1.2.3
exit 1
endif
.PHONY: build
build:
go build
.PHONY: test
test:
go test -race -count=1 -parallel=1 -v ./test/...
go test -race -count=1 -parallel=1 -v ./collector/...
# TODO: Fix certs use "insecure algorithm SHA1-RSA", then remove GODEBUG
GODEBUG=x509sha1=1 go test -race -count=1 -parallel=1 -v ./exporter/...
.PHONY: test-cover
test-cover:
./scripts/cov.sh
.PHONY: test-cover-ci
test-cover-ci:
./scripts/cov.sh CI
.PHONY: install-tools
install-tools:
cd /tmp && go install github.com/wadey/gocovmerge@latest
cd /tmp && go install github.com/golangci/golangci-lint/cmd/golangci-lint@6f7f8ae
.PHONY: lint
lint:
go vet ./...
$(shell go env GOPATH)/bin/golangci-lint run \
--no-config --exclude-use-default=false --max-same-issues=0 \
--disable errcheck \
--enable revive \
--enable stylecheck \
--enable unconvert \
--enable dupl \
--enable gocyclo \
--enable gofmt \
--enable goimports \
--enable misspell \
--enable lll \
--enable unparam \
--enable nakedret \
--enable prealloc \
--enable exportloopref \
--enable gocritic \
--enable gochecknoinits \
./...