-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathMakefile
67 lines (45 loc) · 1.57 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
ifndef PKGS
PKGS := $(shell go list ./... 2>&1 | grep -v 'github.com/libopenstorage/autopilot-api/vendor' | grep -v 'pkg/client/informers/externalversions' | grep -v versioned | grep -v 'pkg/apis/autopilot')
endif
GO_FILES := $(shell find . -name '*.go' | grep -v vendor | \
grep -v '\.pb\.go' | \
grep -v '\.pb\.gw\.go' | \
grep -v 'externalversions' | \
grep -v 'versioned' | \
grep -v 'generated')
ifeq ($(BUILD_TYPE),debug)
BUILDFLAGS += -gcflags "-N -l"
endif
LDFLAGS += "-s -w"
BUILD_OPTIONS := -ldflags=$(LDFLAGS)
.DEFAULT_GOAL=all
.PHONY: clean vendor vendor-update
all: check-fmt vet lint staticcheck
vendor-update:
dep ensure -update
vendor:
dep ensure
check-fmt:
bash -c "diff -u <(echo -n) <(gofmt -l -d -s -e $(GO_FILES))"
lint: $(GOPATH)/bin/golint
# golint check ...
@for file in $(GO_FILES); do $(GOPATH)/bin/golint -set_exit_status $${file} || exit 1; done
vet:
go vet ./...
$(GOPATH)/bin/golint:
go install golang.org/x/lint/golint@latest
$(GOPATH)/bin/staticcheck:
go install honnef.co/go/tools/cmd/staticcheck@latest
$(GOPATH)/bin/errcheck:
go install github.com/kisielk/errcheck@latest
staticcheck: $(GOPATH)/bin/staticcheck
$(GOPATH)/bin/staticcheck ./...
errcheck: $(GOPATH)/bin/errcheck
# errcheck check ...
@$(GOPATH)/bin/errcheck -verbose -blank ./...
pretest: lint vet errcheck staticcheck
codegen:
@echo "Generating CRD"
@hack/update-codegen.sh
clean:
go clean -i $(PKGS)