-
Notifications
You must be signed in to change notification settings - Fork 34
/
Makefile
81 lines (61 loc) · 1.88 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
TEST?=$$(go list ./... |grep -v 'vendor')
ERRCHECK=errcheck
GOCONST=goconst
GOCYCLO=gocyclo
GOFMT:=gofumpt
GOLINT=golint
SHADOW=shadow
STATICCHECK=staticcheck
GOBIN ?= $(shell go env GOPATH)/bin
ifdef TEST_FILTER
TEST_FILTER := -run $(TEST_FILTER)
endif
default: build
dep: # Download required dependencies
go mod tidy
build: fmtcheck
go build -o $(GOBIN)/okta-aws-cli cmd/okta-aws-cli/main.go
clean:
rm -fr dist/
go clean -testcache
fmt: tools # Format the code
@$(GOFMT) -l -w .
test:
go test -race -v $(TEST) || exit 1
test-compile:
go test -c $(TEST) $(TESTARGS)
errcheck:
@errcheck ./...
fmtcheck:
@gofumpt -d -l .
goconst:
$(GOBIN)/goconst ./...
gocyclo:
@gocyclo -over 3 .
lint:
@golint -set_exit_status ./...
shadow:
@go vet -vettool=$(which shadow) ./...
staticcheck:
$(GOBIN)/staticcheck -fail all ./...
vet:
@go vet ./...
# TODO add in gocyclo after code is cleaned up further
qc: fmtcheck errcheck goconst shadow lint staticcheck vet
tools:
@which $(ERRCHECK) || go install github.com/kisielk/errcheck@latest
@which $(GOCONST) || go install github.com/jgautheron/goconst/cmd/goconst@latest
@which $(GOCYCLO) || go install github.com/fzipp/gocyclo/cmd/gocyclo@latest
@which $(GOFMT) || go install mvdan.cc/gofumpt@latest
@which $(GOLINT) || go install golang.org/x/lint/golint@latest
@which $(SHADOW) || go mod download golang.org/x/tools
@which $(STATICCHECK) || go install honnef.co/go/tools/cmd/staticcheck@latest
tools-update:
@go install github.com/kisielk/errcheck@latest
@go install github.com/jgautheron/goconst/cmd/goconst@latest
@go install github.com/fzipp/gocyclo/cmd/gocyclo@latest
@go install mvdan.cc/gofumpt@latest
@go install golang.org/x/lint/golint@latest
@go mod download golang.org/x/tools
@go install honnef.co/go/tools/cmd/staticcheck@latest
.PHONY: dep build clean clean-all fmt fmtcheck test test-compile lint vet tools test-compile