forked from prometheus/blackbox_exporter
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
88 lines (67 loc) · 1.87 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
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
PROJECT = blackbox_exporter
REGISTRY ?= docker.io/emmanuel
IMAGE := $(REGISTRY)/$(PROJECT)
SRCDIRS := ./cmd ./internal
PKGS := $(shell go list ./cmd/... ./internal/...)
GIT_REF = $(shell git rev-parse --short=8 --verify HEAD)
VERSION ?= $(GIT_REF)
test: install
go test ./...
test-race: | test
go test -race ./...
vet: | test
go vet ./...
check: test test-race vet gofmt staticcheck unused misspell unconvert gosimple ineffassign
@echo Checking rendered files are up to date
@(cd deployment && bash render.sh && git diff --exit-code . || (echo "rendered files are out of date" && exit 1))
install:
go install -v ./...
dep:
dep ensure -vendor-only -v
container:
docker build . -t $(IMAGE):$(VERSION)
push: container
docker push $(IMAGE):$(VERSION)
@if git describe --tags --exact-match >/dev/null 2>&1; \
then \
docker tag $(IMAGE):$(VERSION) $(IMAGE):latest; \
docker push $(IMAGE):latest; \
fi
staticcheck:
@go get honnef.co/go/tools/cmd/staticcheck
staticcheck $(PKGS)
unused:
@go get honnef.co/go/tools/cmd/unused
unused -exported $(PKGS)
misspell:
@go get github.com/client9/misspell/cmd/misspell
misspell \
-i clas \
-locale US \
-error \
cmd/* internal/* docs/* design/* *.md
unconvert:
@go get github.com/mdempsky/unconvert
unconvert -v $(PKGS)
gosimple:
@go get honnef.co/go/tools/cmd/gosimple
gosimple $(PKGS)
ineffassign:
@go get github.com/gordonklaus/ineffassign
find $(SRCDIRS) -name '*.go' | xargs ineffassign
pedantic: check unparam errcheck
unparam:
@go get mvdan.cc/unparam
unparam ./...
errcheck:
@go get github.com/kisielk/errcheck
errcheck $(PKGS)
render:
@echo Rendering deployment files...
@(cd deployment && bash render.sh)
updategenerated:
@echo Updating CRD generated code...
@(bash hack/update-generated-crd-code.sh)
gofmt:
@echo Checking code is gofmted
@test -z "$(shell gofmt -s -l -d -e $(SRCDIRS) | tee /dev/stderr)"