-
Notifications
You must be signed in to change notification settings - Fork 0
/
Taskfile.yml
62 lines (51 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
60
61
62
version: "3"
silent: true
vars:
TOOL_BIN_DIR: ./bin/tools
TOOL_LINT_SRC: github.com/golangci/golangci-lint/cmd/[email protected]
TOOL_LINT: ./{{ .TOOL_BIN_DIR }}/golangci-lint
TOOL_GOIMPORTS_SRC: golang.org/x/tools/cmd/[email protected]
TOOL_GOIMPORTS: ./{{ .TOOL_BIN_DIR }}/goimports
TOOL_GOFUMPT_SRC: mvdan.cc/[email protected]
TOOL_GOFUMPT: ./{{ .TOOL_BIN_DIR }}/gofumpt
tasks:
check:
desc: Run all project checks
cmds:
- task: "go:tidy"
- task: "test"
- task: "fmt"
- task: "lint"
tools:install:
vars:
GOBIN:
sh: "echo `pwd`/{{ .TOOL_BIN_DIR }}"
cmds:
- echo '>>> Run install tools'
- rm -rf {{ .TOOL_BIN_DIR }}
- mkdir -p {{ .TOOL_BIN_DIR }}
- export GOBIN="{{ .GOBIN }}" && go install {{ .TOOL_LINT_SRC }}
- export GOBIN="{{ .GOBIN }}" && go install {{ .TOOL_GOIMPORTS_SRC }}
- export GOBIN="{{ .GOBIN }}" && go install {{ .TOOL_GOFUMPT_SRC }}
go:tidy:
cmds:
- echo '>>> Run go get ./...'
- go get ./...
- echo '>>> Run go tidy'
- go mod tidy
lint:
desc: Run static analysis
cmds:
- echo '>>> Run golangci-lint'
- "{{ .TOOL_LINT }} run"
fmt:
desc: Safe formatting codebase
cmds:
- echo ">>> Run Code Formatter"
- go fmt ./...
- "{{ .TOOL_GOFUMPT }} -l -w ."
- "{{ .TOOL_GOIMPORTS }} -l -w ."
test:
cmds:
- echo ">>> Go test ./..."
- go test -v ./...