-
Notifications
You must be signed in to change notification settings - Fork 4
/
Makefile
70 lines (49 loc) · 1.62 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
all: clean check-quality build test golangci update-doc
ALL_PACKAGES=$(shell go list ./...)
SOURCE_DIRS=$(shell go list ./... | cut -d "/" -f4 | uniq)
clean:
rm -rf ./bin
GO111MODULE=on go mod tidy -v
check-quality: setup lint fmt imports vet
setup:
GO111MODULE=off go get -v golang.org/x/tools/cmd/goimports
GO111MODULE=off go get -v golang.org/x/lint/golint
lint:
@if [[ `golint $(ALL_PACKAGES) | { grep -vwE "exported (var|function|method|type|const) \S+ should have comment" || true; } | wc -l | tr -d ' '` -ne 0 ]]; then \
golint $(ALL_PACKAGES) | { grep -vwE "exported (var|function|method|type|const) \S+ should have comment" || true; }; \
exit 2; \
fi;
fmt:
gofmt -l -s -w $(SOURCE_DIRS)
imports:
./scripts/lint.sh check_imports
vet:
go vet ./...
cyclo:
gocyclo -over 6 $(SOURCE_DIRS)
fix_imports:
goimports -l -w .
golangci:
curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b bin/ v1.30.0
bin/golangci-lint run -v --deadline 5m0s
build:
@echo "Building './bin/albatross'"
@mkdir -p ./bin
@go build -race -o bin/albatross ./cmd/albatross
test:
go test -race ./...
testcodecov:
go test -race -coverprofile=coverage.txt -covermode=atomic ./...
run: build
./bin/albatross
update-doc:
./scripts/swagger.sh create_doc
./scripts/swagger.sh validate_doc
serve-api-doc:
GO111MODULE=off go get -v github.com/go-swagger/go-swagger/cmd/swagger
swagger serve docs/swagger.json --flavor=swagger
check-doc:
./scripts/swagger.sh check_doc_ci
./scripts/swagger.sh check_for_change
run-with-doc: build update-doc
DOCUMENTATION=true ./bin/albatross