-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
49 lines (42 loc) · 1.34 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
help:
@echo "linter-fix solve simple linter porblems like fmt"
@echo "linter-get install golangcli-linter"
@echo "lint run golangcli-linter"
@echo "dependencies install development dependencies"
@echo "test run tests and create coverage and report"
linter-get:
curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s v1.36.0
lint:
$(GO_VARS) ./bin/golangci-lint run --timeout 10m
lint-fix:
# run goimports for all files
find . -name \*.go -exec goimports -w {} \;
dependencies:
go mod download
test: */*/*.go
$(GO_VARS) $(GO) test $(GO_PACKAGES) \
-cover -coverpkg=./... -coverprofile=.test.profile.cov -timeout 1m -v -failfast && \
echo -e "\nTesting is passed." && \
$(GO_VARS) $(GO) tool cover -func .test.profile.cov && \
$(GO) tool cover -html=.test.profile.cov -o coverage.html
### COMMON VARIABLES ###
UNAME_S := $(shell uname -s)
ifeq ($(UNAME_S), Linux)
OS ?= linux
endif
ifeq ($(UNAME_S), Darwin)
OS ?= osx
endif
ARCH := $(shell uname -m)
ifeq ($(ARCH), unknown)
ARCH := x86_64
endif
ifeq ($(ARCH), i386)
ARCH = x86_32
endif
GO_VARS ?=
GO_PACKAGES := $(shell go list ./... | grep -v /examples/ | grep -v /internal/testutil/)
GO ?= CGO_ENABLED=0 go
GIT ?= git
COMMIT := $(shell $(GIT) rev-parse HEAD)
VERSION ?= $(shell $(GIT) describe --tags ${COMMIT} 2> /dev/null || echo "$(COMMIT)")