-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
67 lines (45 loc) · 1.25 KB
/
Makefile
File metadata and controls
67 lines (45 loc) · 1.25 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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
SHELL := /bin/bash
GO := go
MODULE := github.com/fbsobreira/gotron-examples
EXAMPLES := address justlend-energy sunswap
GOIMPORTS_VERSION := v0.28.0
.PHONY: all build tidy tidy-check fmt fmt-check lint check clean $(addprefix run/,$(EXAMPLES))
all: check build
## Build
build:
$(GO) build ./...
## Dependencies
tidy:
$(GO) mod tidy
tidy-check:
$(GO) mod tidy
git diff --exit-code go.mod go.sum
## Formatting
fmt:
@which goimports > /dev/null || $(GO) install golang.org/x/tools/cmd/goimports@$(GOIMPORTS_VERSION)
goimports -w -local $(MODULE) .
fmt-check:
@which goimports > /dev/null || $(GO) install golang.org/x/tools/cmd/goimports@$(GOIMPORTS_VERSION)
@diff=$$(goimports -l -local $(MODULE) .); \
if [ -n "$$diff" ]; then \
echo "goimports: files need formatting:"; \
echo "$$diff"; \
exit 1; \
fi
## Linting
# Install golangci-lint via: brew install golangci-lint
# or: https://golangci-lint.run/welcome/install/
lint:
golangci-lint run ./...
## Combined checks (matches CI)
check: tidy-check fmt-check lint build
## Run examples
run/address:
$(GO) run ./examples/address
run/sunswap:
$(GO) run ./examples/sunswap $(ARGS)
run/justlend-energy:
$(GO) run ./examples/justlend-energy $(ARGS)
## Cleanup
clean:
$(GO) clean ./...