Skip to content

Commit c5e906f

Browse files
committed
Makefile
1 parent 0b2f84b commit c5e906f

1 file changed

Lines changed: 40 additions & 0 deletions

File tree

Makefile

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
SHELL := /usr/bin/env bash
2+
3+
GO ?= go
4+
GO_FILES := $(shell git ls-files '*.go')
5+
6+
.PHONY: fmt fmt-check mod-tidy-check vet test test-race build examples ci
7+
8+
fmt:
9+
$(GO) fmt ./...
10+
11+
fmt-check:
12+
@out="$$(gofmt -l $(GO_FILES))"; \
13+
if [[ -n "$$out" ]]; then \
14+
echo "These files are not gofmt-formatted:"; \
15+
echo "$$out"; \
16+
exit 1; \
17+
fi
18+
19+
mod-tidy-check:
20+
$(GO) mod tidy
21+
@git diff --exit-code -- go.mod go.sum
22+
23+
vet:
24+
$(GO) vet ./...
25+
26+
test:
27+
$(GO) test ./...
28+
29+
test-race:
30+
$(GO) test -race ./...
31+
32+
build:
33+
$(GO) build ./...
34+
35+
examples:
36+
$(GO) run ./examples/basic-authorization >/dev/null
37+
$(GO) run ./examples/transaction-batching >/dev/null
38+
$(GO) run ./examples/send-userop >/dev/null
39+
40+
ci: fmt-check mod-tidy-check vet test-race build examples

0 commit comments

Comments
 (0)