-
Notifications
You must be signed in to change notification settings - Fork 7
Expand file tree
/
Copy pathMakefile
More file actions
26 lines (20 loc) · 812 Bytes
/
Makefile
File metadata and controls
26 lines (20 loc) · 812 Bytes
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
SQLC_VERSION := v1.20.0
.PHONY: clean generate gen-mocks gen-sqlc check-sqlc
generate: clean gen-sqlc
@go generate ./...
gen-sqlc: check-sqlc
sqlc generate -f ./internal/example/db/sqlc.yaml
check-sqlc:
@if ! command -v mockery &> /dev/null; then \
echo "sqlc could not be found"; \
echo "Installing sqlc $(SQLC_VERSION)"; \
go install github.com/sqlc-dev/sqlc/cmd/sqlc@$(SQLC_VERSION); \
elif ! sqlc version 2> /dev/null | grep -q $(SQLC_VERSION); then \
echo "Incorrect version of sqlc found"; \
echo "Installing sqlc $(SQLC_VERSION)"; \
go install github.com/sqlc-dev/sqlc/cmd/sqlc@$(SQLC_VERSION); \
else \
echo "Required sqlc version $(SQLC_VERSION) is already installed"; \
fi
clean:
find . -type f -name "*.go" -exec grep -qE "// Code generated .* DO NOT EDIT\." {} \; -delete