forked from IBM/secret-utils-lib
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
54 lines (41 loc) · 1.45 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
GOPACKAGES=$(shell go list ./... | grep -v /vendor/ | grep -v /tests)
GOFILES=$(shell find . -type f -name '*.go' -not -path "./vendor/*" -not -path "./tests/e2e/*")
VERSION := latest
GIT_COMMIT_SHA="$(shell git rev-parse HEAD 2>/dev/null)"
GIT_REMOTE_URL="$(shell git config --get remote.origin.url 2>/dev/null)"
BUILD_DATE="$(shell date -u +"%Y-%m-%dT%H:%M:%SZ")"
ARCH=$(shell docker version -f {{.Client.Arch}})
GO111MODULE_FLAG?=on
export GO111MODULE=$(GO111MODULE_FLAG)
export LINT_VERSION="1.45.2"
COLOR_YELLOW=\033[0;33m
COLOR_RESET=\033[0m
OSS_FILES := go.mod
.PHONY: all
all: deps fmt vet test
.PHONY: deps
deps:
echo "Installing dependencies ..."
go mod vendor
go get 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: lint
golangci-lint run --disable-all --enable=gofmt --timeout 600s --skip-dirs=tests
.PHONY: dofmt
dofmt:
golangci-lint run --disable-all --enable=gofmt --fix --skip-dirs=tests
.PHONY: lint
lint:
golangci-lint run --timeout 600s --skip-dirs=tests
.PHONY: vet
vet:
go vet ${GOPACKAGES}
.PHONY: test
test:
$(GOPATH)/bin/gotestcover -v -race -short -coverprofile=cover.out ${GOPACKAGES}
go tool cover -html=cover.out -o=cover.html
.PHONY: ut-coverage
ut-coverage: deps fmt vet test