-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
53 lines (41 loc) · 1.31 KB
/
Makefile
File metadata and controls
53 lines (41 loc) · 1.31 KB
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
SHELL := bash
.ONESHELL:
.SHELLFLAGS := -eu -o pipefail -c
MAKEFLAGS += --warn-undefined-variables
MAKEFLAGS += --no-builtin-rules
CURPATH := ${shell pwd}
# Filter down to run tests only in this path. To run all the tests from all the project folders use ./...
# To run tests only in root use ./.
# Make sure TESTREGEX below is set to an appropiate value too.
TESTPATH := ./...
# Filter down to testing only a portion of the tests by using a regex to match test names. Ex. TestUpsertUser
# To test multiple at once separate with / ex: TestUpsertUser/TestGetUserIDsByToken
# To test all use dot ex. .
TESTREGEX := .
# Running 'make cover' will create a test coverage report html file in the root of the source folder.
COVERAGEREPORT := ${CURPATH}/coverage-report.html
INPUT := ${CURPATH}/error.go
.PHONY: lint
lint:
golangci-lint run --config ./.golangci.yaml ./...
.PHONY: update-deps-latest
update-deps-latest:
go mod tidy
go get -u ./...
.PHONY: update-deps
update-deps:
go mod tidy
go get ./...
.PHONY: clean
clean:
go clean ${INPUT}
.PHONY: format
format:
gofmt -w ${CURPATH}
.PHONY: test
test: format lint
clear && printf '\e[3J'
go clean -testcache
go test -coverprofile /tmp/cover.out -v -failfast -run ${TESTREGEX} ${TESTPATH}
go tool cover -html=/tmp/cover.out -o ${COVERAGEREPORT}
rm -rf /tmp/cover.out