-
Notifications
You must be signed in to change notification settings - Fork 8
/
Makefile
58 lines (45 loc) · 1.34 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
.DEFAULT_GOAL := test
.PHONY: test
test: test-unit test-integration test-docker
.PHONY: test-unit
test-unit:
@go test -count=1 -v -race -cover ./...
.PHONY: docker-test
test-docker:
@./tests/docker/test.sh
.PHONY: test-integration
test-integration:
$(MAKE) -C ./instrumentation/opentelemetry/github.com/jackc/hyperpgx/integrationtest test
.PHONY: bench
bench:
go test -v -run - -bench . -benchmem ./...
.PHONY: lint
lint:
@echo "Running linters..."
@golangci-lint run ./... && echo "Done."
.PHONY: deps
deps:
@go get -v -t -d ./...
.PHONY: ci-deps
deps-ci:
@go get github.com/golangci/golangci-lint/cmd/golangci-lint
check-examples:
@find ./examples -type d -print | \
xargs -I {} bash -c 'if [ -f "{}/main.go" ] ; then cd {}; echo "=> {}"; go build -o ./build_example main.go ; fi'
@find . -name "build_example" -delete
.PHONY: fmt
fmt:
gofmt -w -s ./
.PHONY: tidy
tidy:
@find . -name "go.mod" \
| grep go.mod \
| xargs -I {} bash -c 'dirname {}' \
| xargs -I {} bash -c 'echo "=> {}"; cd {}; go mod tidy -v -compat=1.18; '
.PHONY: install-tools
install-tools: ## Install all the dependencies under the tools module
$(MAKE) -C ./tools install
.PHONY: check-vanity-import
check-vanity-import:
@porto -l .
@if [[ "$(porto --skip-files ".*\\.pb\\.go$" -l . | wc -c | xargs)" -ne "0" ]]; then echo "Vanity imports are not up to date" ; exit 1 ; fi