-
Notifications
You must be signed in to change notification settings - Fork 0
/
Taskfile.yml
executable file
·59 lines (49 loc) · 1.45 KB
/
Taskfile.yml
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
version: '3'
vars:
GOBIN: $(pwd)/bin
tasks:
run:
desc: "Run the application"
cmds:
- go run postgres/example/main.go
mock:
cmds:
- "{{.GOBIN}}/mockgen -package=mock -destination=kafka/mock/sync.go -source=kafka/sync.go"
- "{{.GOBIN}}/mockgen -package=mock -destination=kafka/mock/async.go -source=kafka/async.go"
- "{{.GOBIN}}/mockgen -package=mock -destination=kafka/mock/consumer_group.go -source=kafka/consumer_group.go"
format:
cmds:
- task: go_files
vars: { COMMAND: 'gofmt -w {} +'}
- task: go_files
vars: { COMMAND: '{{.GOBIN}}/goimports -w {} +'}
test:
cmds:
- go test -v -race -cover ./...
lint:
cmds:
- "{{.GOBIN}}/revive
-config revive.toml
-formatter friendly
-exclude ./**/mock
./..."
precommit:
desc: "Run all precommit checks"
cmds:
- task: format
- task: lint
- task: test
deps:
- GOBIN={{.GOBIN}} go install golang.org/x/tools/cmd/goimports@v0.19.0
- GOBIN={{.GOBIN}} go install github.com/mgechev/revive@v1.3.7
- GOBIN={{.GOBIN}} go install github.com/gotesttools/gotestfmt/v2/cmd/gotestfmt@v2.5.0
- GOBIN={{.GOBIN}} go install github.com/golang/mock/mockgen@v1.6.0
## INTERNAL COMMANDS
go_files:
desc: "Return all .go files and run .COMMAND on them"
internal: true
cmds:
- find .
-name "*.go"
-not -path ./mock
-exec {{.COMMAND}};