Repository navigation
Expand file tree
/
Copy pathTaskfile.yml
More file actions
84 lines (72 loc) · 1.79 KB
/
Copy pathTaskfile.yml
File metadata and controls
84 lines (72 loc) · 1.79 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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
version: '3'
vars:
# Bump deliberately; see https://pkg.go.dev/golang.org/x/vuln/cmd/govulncheck?tab=versions
GOVULNCHECK_VERSION: v1.9.0
tasks:
fmt:
desc: Format all Go source files
cmds:
- go fmt ./...
vet:
desc: Run go vet over all packages
cmds:
- go vet ./...
check:
desc: Run go fmt and go vet
cmds:
- task: fmt
- task: vet
test:
desc: Run all tests
cmds:
- go test ./...
lint:
desc: Run golangci-lint (extra flags after --, e.g. task lint -- --new-from-merge-base=origin/main)
cmds:
- golangci-lint run {{.CLI_ARGS}} ./...
fmt-check:
desc: Fail if any Go files need gofmt (reports only; does not rewrite files)
cmds:
- |
unformatted=$(gofmt -l .)
if [ -n "$unformatted" ]; then
echo "These files need gofmt (run task fmt):"
echo "$unformatted"
exit 1
fi
tidy-check:
desc: Fail if go.mod/go.sum are not tidy
cmds:
- go mod tidy -diff
vuln:
desc: Report known vulnerabilities (Go vulndb) reachable from this module's code, including the Go standard library
cmds:
- go run golang.org/x/vuln/cmd/govulncheck@{{.GOVULNCHECK_VERSION}} ./...
ci:
desc: Non-mutating checks for CI (gofmt, vet, go.mod tidiness, govulncheck, race-enabled tests)
cmds:
- task: fmt-check
- task: vet
- task: tidy-check
- task: vuln
- go test ./... -count=1 -race
build:
desc: Build the ft binary into the repo root
deps:
- vet
- test
sources:
- '**/*.go'
- go.mod
- go.sum
generates:
- ft
cmds:
- go build -o ft ./cmd/ft
install:
desc: Install ft into GOBIN (~/go/bin)
deps:
- vet
- test
cmds:
- go install ./cmd/ft