-
Notifications
You must be signed in to change notification settings - Fork 80
/
Makefile
60 lines (46 loc) · 1.31 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
.PHONY: default install build build-cross clean test quicktest fmt vet lint install-deps update-deps clean-deps
default: fmt vet lint build quicktest
run:
go run ./cmd/audit2rbac/audit2rbac.go
install-deps:
go mod vendor
build/update-vendor-notices.sh
update-deps:
go mod vendor
build/update-vendor-notices.sh
clean-deps:
rm -fr vendor
build:
go build -o bin/audit2rbac $(shell ./build/print-ldflags.sh) ./cmd/audit2rbac
build-cross:
./build/build-cross.sh cmd/audit2rbac/audit2rbac.go
install:
go install $(shell ./build/print-ldflags.sh) ./cmd/audit2rbac
clean:
rm -fr bin
test:
go test -v -race -cover ./pkg/... ./cmd/...
quicktest:
go test ./pkg/... ./cmd/...
# Capture output and force failure when there is non-empty output
fmt:
@echo gofmt -l ./pkg
@OUTPUT=`gofmt -l ./pkg 2>&1`; \
if [ "$$OUTPUT" ]; then \
echo "gofmt must be run on the following files:"; \
echo "$$OUTPUT"; \
exit 1; \
fi
vet:
go vet -atomic -bool -copylocks -nilfunc -printf -rangeloops -unreachable -unsafeptr -unusedresult ./pkg
# https://github.com/golang/lint
# go get github.com/golang/lint/golint
# Capture output and force failure when there is non-empty output
lint:
@echo golint ./pkg/...
@OUTPUT=`golint ./pkg/... 2>&1`; \
if [ "$$OUTPUT" ]; then \
echo "golint errors:"; \
echo "$$OUTPUT"; \
exit 1; \
fi