-
Notifications
You must be signed in to change notification settings - Fork 9
/
Makefile
49 lines (38 loc) · 1.15 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
GOPACKAGES=$(shell go list ./... | grep -v /vendor/ | grep -v /samples)
GOFILES=$(shell find . -type f -name '*.go' -not -path "./vendor/*")
ARCH = $(shell uname -m)
LINT_VERSION="1.45.2"
.PHONY: all
all: deps dofmt vet test
.PHONY: deps
deps:
go mod download
go get github.com/pierrre/gotestcover
go install github.com/pierrre/gotestcover
@if ! which golangci-lint >/dev/null || [[ "$$(golangci-lint --version)" != *${LINT_VERSION}* ]]; then \
curl -sfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(shell go env GOPATH)/bin v${LINT_VERSION}; \
fi
.PHONY: fmt
fmt:
golangci-lint run --disable-all --enable=gofmt
.PHONY: dofmt
dofmt:
golangci-lint run --disable-all --enable=gofmt --fix
.PHONY: lint
lint:
golangci-lint run
.PHONY: makefmt
makefmt:
gofmt -l -w ${GOFILES}
.PHONY: build
build:
go build -gcflags '-N -l' -o libSample samples/main.go samples/attach_detach.go samples/volume_operations.go
.PHONY: test
test:
$(GOPATH)/bin/gotestcover -v -coverprofile=cover.out ${GOPACKAGES} -timeout 90m
.PHONY: coverage
coverage:
go tool cover -html=cover.out -o=cover.html
.PHONY: vet
vet:
go vet ${GOPACKAGES}