1# https://taskfile.dev
 2
 3version: "3"
 4
 5env:
 6  CGO_ENABLED: 0
 7  GOEXPERIMENT: greenteagc
 8
 9tasks:
10  lint:install:
11    desc: Install golangci-lint
12    cmds:
13      - go install github.com/golangci/golangci-lint/v2/cmd/golangci-lint@latest
14    env:
15      GOTOOLCHAIN: go1.25.0
16
17  lint:
18    desc: Run base linters
19    cmds:
20      - golangci-lint run --path-mode=abs --config=".golangci.yml" --timeout=5m
21    env:
22      GOEXPERIMENT: null
23
24  lint-fix:
25    desc: Run base linters and fix issues
26    cmds:
27      - golangci-lint run --path-mode=abs --config=".golangci.yml" --timeout=5m --fix
28    env:
29      GOEXPERIMENT: null
30
31  build:
32    desc: Run build
33    cmds:
34      - go build .
35    generates:
36      - crush
37
38  test:
39    desc: Run tests
40    cmds:
41      - go test ./... {{.CLI_ARGS}}
42
43  fmt:
44    desc: Run gofumpt
45    cmds:
46      - gofumpt -w .
47
48  dev:
49    desc: Run with profiling enabled
50    env:
51      CRUSH_PROFILE: true
52    cmds:
53      - go run .
54
55  install:
56    desc: Install the application
57    cmds:
58      - go install -v .
59
60  profile:cpu:
61    desc: 10s CPU profile
62    cmds:
63      - go tool pprof -http :6061 'http://localhost:6060/debug/pprof/profile?seconds=10'
64
65  profile:heap:
66    desc: Heap profile
67    cmds:
68      - go tool pprof -http :6061 'http://localhost:6060/debug/pprof/heap'
69
70  profile:allocs:
71    desc: Allocations profile
72    cmds:
73      - go tool pprof -http :6061 'http://localhost:6060/debug/pprof/allocs'
74
75  schema:
76    desc: Generate JSON schema for configuration
77    cmds:
78      - go run main.go schema > schema.json
79      - echo "Generated schema.json"
80    generates:
81      - schema.json