-
Notifications
You must be signed in to change notification settings - Fork 0
/
Taskfile.yml
73 lines (60 loc) · 1.71 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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
# https://taskfile.dev
version: "3"
vars:
COV_DATA: coverage.out
tasks:
default:
desc: List all available tasks
silent: true
cmd: task --list
tidy:
desc: Tidy dependencies in go.mod and go.sum
cmd: go mod tidy
fmt:
desc: Run go fmt on all source files
preconditions:
- sh: command -v golines
msg: golines not installed, see https://github.com/segmentio/golines
cmds:
- go fmt ./...
- golines . --chain-split-dots --ignore-generated --write-output
test:
desc: Run the test suite
cmd: go test -race ./... {{ .CLI_ARGS }}
bench:
desc: Run all project benchmarks
cmd: go test ./... -run None -benchmem -bench . {{ .CLI_ARGS }}
lint:
desc: Run the linters and auto-fix if possible
cmd: golangci-lint run --fix
deps:
- fmt
preconditions:
- sh: command -v golangci-lint
msg: golangci-lint not installed, see https://golangci-lint.run/usage/install/#local-installation
doc:
desc: Render the pkg docs locally
cmd: pkgsite -open
preconditions:
- sh: command -v pkgsite
msg: pkgsite not installed, run go install golang.org/x/pkgsite/cmd/pkgsite@latest
cov:
desc: Calculate test coverage and render the html
generates:
- "{{ .COV_DATA }}"
cmds:
- go test -race -cover -covermode atomic -coverprofile {{ .COV_DATA }} ./...
- go tool cover -html {{ .COV_DATA }}
check:
desc: Run tests and linting in one
cmds:
- task: test
- task: lint
sloc:
desc: Print lines of code
cmd: fd . -e go | xargs wc -l | sort -nr | head
clean:
desc: Remove build artifacts and other clutter
cmds:
- go clean ./...
- rm -rf {{ .COV_DATA }}