-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
49 lines (40 loc) · 1.01 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
SOURCE_FILES?=./...
TEST_PATTERN?=.
TEST_OPTIONS?=
export GO111MODULE := on
.DEFAULT_GOAL := build
######################
# Setup #
######################
tools:
GO111MODULE=on go install github.com/golangci/golangci-lint/cmd/golangci-lint
.PHONY: tools
######################
# Building #
######################
build: fmtcheck lint
go build ./...
.PHONY: build
######################
# Testing #
######################
test: build
go test $(TEST_OPTIONS) -failfast -race -coverpkg=./... -covermode=atomic -coverprofile=coverage.txt $(SOURCE_FILES) -run $(TEST_PATTERN) -timeout=2m
.PHONY: test
######################
# Formatting/Linting #
######################
fmt:
@echo "==> Fixing source code with gofmt..."
gofmt -s -w ./$(PKG_NAME)
.PHONY: fmt
fmtcheck:
@sh -c "'$(CURDIR)/scripts/gofmtcheck.sh'"
.PHONY: fmtcheck
lint:
@echo "==> Checking source code against linters..."
@GOGC=30 golangci-lint run ./...
.PHONY: lint
cover: test
go tool cover -html=coverage.txt
.PHONY: cover