-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTaskfile.yml
More file actions
61 lines (53 loc) · 1.39 KB
/
Taskfile.yml
File metadata and controls
61 lines (53 loc) · 1.39 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
version: "3"
env:
GOCACHE: /tmp/go-cache
GOMODCACHE: /tmp/go-modcache
GOLANGCI_LINT_CACHE: /tmp/golangci-lint-cache
tasks:
go:fmt:
desc: Format Go sources
cmds:
- |
set -euo pipefail
files="$(find . -type f -name '*.go' -not -path './vendor/*')"
if [ -n "$files" ]; then
gofmt -w $files
fi
go:lint:
desc: Run golangci-lint for all Go packages
cmds:
- golangci-lint run ./...
go:deadcode:
desc: Run deadcode analysis for all packages (including tests)
preconditions:
- sh: test -x "$(go env GOPATH)/bin/deadcode"
msg: "deadcode is not installed. Install with: go install golang.org/x/tools/cmd/deadcode@latest"
cmds:
- |
deadcode_bin="$(go env GOPATH)/bin/deadcode"
output="$(HOME=/tmp XDG_CACHE_HOME=/tmp "$deadcode_bin" -test ./...)"
if [ -n "$output" ]; then
echo "$output"
echo
echo "deadcode validation failed: remove unreachable functions or justify exclusions."
exit 1
fi
go:test:
desc: Run Go tests for all packages
cmds:
- go test ./...
fix:
desc: Run auto-fixes
cmds:
- task: go:fmt
validate:
desc: Run project validation checks
cmds:
- task: go:lint
- task: go:deadcode
test:
desc: Run test suite
deps:
- validate
cmds:
- task: go:test