forked from projectcontour/gimbal
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
72 lines (54 loc) · 1.39 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
PROJECT = gimbal
REGISTRY ?= gcr.io/heptio-images
IMAGE := $(REGISTRY)/$(PROJECT)
SRCDIRS := ./cmd ./pkg
# PHONY = gencerts
TAG_LATEST ?= false
GIT_REF = $(shell git rev-parse --short=8 --verify HEAD)
VERSION ?= $(GIT_REF)
export GO111MODULE=on
test: install
go test -mod=readonly ./...
vet: | test
go vet ./...
check: test vet gofmt staticcheck misspell unconvert unparam ineffassign
install:
go install -mod=readonly -v ./...
download:
go mod download
container:
docker build . -t $(IMAGE):$(VERSION)
push: container
docker push $(IMAGE):$(VERSION)
ifeq ($(TAG_LATEST), true)
docker tag $(IMAGE):$(VERSION) $(IMAGE):latest
docker push $(IMAGE):latest
endif
staticcheck:
go install honnef.co/go/tools/cmd/staticcheck
staticcheck \
-checks all,-ST1003 \
./cmd/... ./pkg/...
misspell:
go install github.com/client9/misspell/cmd/misspell
misspell \
-i clas \
-locale US \
-error \
cmd/* pkg/* docs/* design/* *.md
unconvert:
go install github.com/mdempsky/unconvert
unconvert -v ./cmd/... ./pkg/...
ineffassign:
go install github.com/gordonklaus/ineffassign
find $(SRCDIRS) -name '*.go' | xargs ineffassign
pedantic: check errcheck
unparam:
go install mvdan.cc/unparam
unparam -exported ./cmd/... ./pkg/...
errcheck:
go install github.com/kisielk/errcheck
errcheck ./...
gofmt:
@echo Checking code is gofmted
@test -z "$(shell gofmt -s -l -d -e $(SRCDIRS) | tee /dev/stderr)"