forked from chrisyxlee/pgxpoolmock
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Makefile
58 lines (44 loc) · 1.32 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
55
56
57
58
.PHONY: mock
mock: bin/mockgen
@mockgen \
-source=pgx.go \
-destination=pgx_mock.go \
-package=pgxpoolmock
@mockgen \
-source=pgx_batch.go \
-destination=pgx_batch_mock.go \
-package=pgxpoolmock
.PHONY: sql
sql: bin/sqlc
@sqlc generate
MOCKGEN_VERSION?=1.6.0
bin/mockgen:
GOBIN=$(shell pwd)/bin/ \
go install github.com/golang/mock/mockgen@v${MOCKGEN_VERSION}
# sqlc generates type-safe code from SQL.
# https://github.com/kyleconroy/sqlc
SQLC_VERSION?=1.15.0
bin/sqlc:
GOBIN=$(shell pwd)/bin/ \
go install github.com/kyleconroy/sqlc/cmd/sqlc@v${SQLC_VERSION}
# ----
## LINTER stuff start
linter_include_check:
@[ -f linter.mk ] && echo "linter.mk include exists" || (echo "getting linter.mk from github.com" && curl -sO https://raw.githubusercontent.com/spacetab-io/makefiles/master/golang/linter.mk)
.PHONY: lint
lint: linter_include_check
@make -f linter.mk go_lint
## LINTER stuff end
# ----
# ----
## TESTS stuff start
tests_include_check:
@[ -f tests.mk ] && echo "tests.mk include exists" || (echo "getting tests.mk from github.com" && curl -sO https://raw.githubusercontent.com/spacetab-io/makefiles/master/golang/tests.mk)
tests: tests_include_check
@make -f tests.mk go_tests
.PHONY: tests
tests_html: tests_include_check
@make -f tests.mk go_tests_html
.PHONY: tests_html
## TESTS stuff end
# ----