Taskfile.yml in go-shrt

at master

1version: "3"
2
3vars:
4 GO: go
5 MISSPELL_FLAGS: -error -locale US
6 STATICCHECK_FLAGS: -checks all,-SA1029,-SA9003,-ST1000,-ST1003,-ST1016,-ST1020,-ST1021,-ST1022,-ST1023
7
8tasks:
9 default:
10 cmds:
11 - task: fast
12
13 fast:
14 desc: run a fast lint/test suite
15 requires:
16 vars: [GO]
17 cmds:
18 - task: goimports
19 - task: staticcheck
20 - task: misspell
21 - task: unparam
22 - task: govet
23 - task: gotest
24
25 full:
26 desc: run a full lint/test suite
27 cmds:
28 - task: default
29 - task: govulncheck
30
31 githook:
32 desc: same as "fast," but changes are automatically applied if possible
33 requires:
34 vars: [GO]
35 cmds:
36 - task: goimports
37 vars: {EXTRA_ARGS: -fix}
38 - task: staticcheck
39 - task: misspell
40 vars: {EXTRA_ARGS: -w}
41 - task: unparam
42 - task: govet
43 - task: gotest
44
45 goimports:
46 desc: (lint, fast) run goimports
47 preconditions:
48 - sh: command -v goimports
49 msg: run '{{.GO}} install golang.org/x/tools/cmd/goimports@latest' and try again
50 shopt: [globstar]
51 requires:
52 vars: [GO]
53 cmds:
54 - "{{.GO}} run ./devtools/checkimports {{.EXTRA_ARGS}} *.go **/*.go"
55
56 gotest:
57 desc: (lint, fast) run go test
58 requires:
59 vars: [GO]
60 cmds:
61 - "{{.GO}} test ./..."
62
63 govet:
64 desc: (lint, fast) run go vet
65 requires:
66 vars: [GO]
67 cmds:
68 - "{{.GO}} vet ./..."
69
70 staticcheck:
71 desc: (lint, fast) run staticcheck
72 preconditions:
73 - sh: command -v staticcheck
74 msg: run '{{.GO}} install honnef.co/go/tools/cmd/staticcheck@latest' and try again
75 cmds:
76 - "staticcheck {{.STATICCHECK_FLAGS}} ./..."
77
78 misspell:
79 desc: (lint, fast) run misspell
80 preconditions:
81 - sh: command -v misspell
82 msg: run '{{.GO}} install github.com/client9/misspell/cmd/misspell@latest' and try again
83 shopt: [globstar]
84 cmds:
85 - misspell {{.EXTRA_ARGS}} {{.MISSPELL_FLAGS}} -source go **/*.go
86 - misspell {{.EXTRA_ARGS}} {{.MISSPELL_FLAGS}} CONTRIBUTING LICENSE README
87
88 unparam:
89 desc: (lint, fast) run unparam
90 preconditions:
91 - sh: command -v unparam
92 msg: run '{{.GO}} install mvdan.cc/unparam@latest' and try again
93 cmds:
94 - unparam ./...
95
96 govulncheck:
97 desc: (lint) run govulncheck
98 preconditions:
99 - sh: command -v govulncheck
100 msg: run '{{.GO}} install golang.org/x/vuln/cmd/govulncheck@latest' and try again
101 cmds:
102 - govulncheck ./...