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  run:
39    desc: Run build
40    cmds:
41      - go run .
42
43  test:
44    desc: Run tests
45    cmds:
46      - go test ./... {{.CLI_ARGS}}
47
48  fmt:
49    desc: Run gofumpt
50    cmds:
51      - gofumpt -w .
52
53  dev:
54    desc: Run with profiling enabled
55    env:
56      CRUSH_PROFILE: true
57    cmds:
58      - go run .
59
60  install:
61    desc: Install the application
62    cmds:
63      - go install -v .
64
65  profile:cpu:
66    desc: 10s CPU profile
67    cmds:
68      - go tool pprof -http :6061 'http://localhost:6060/debug/pprof/profile?seconds=10'
69
70  profile:heap:
71    desc: Heap profile
72    cmds:
73      - go tool pprof -http :6061 'http://localhost:6060/debug/pprof/heap'
74
75  profile:allocs:
76    desc: Allocations profile
77    cmds:
78      - go tool pprof -http :6061 'http://localhost:6060/debug/pprof/allocs'
79
80  schema:
81    desc: Generate JSON schema for configuration
82    cmds:
83      - go run main.go schema > schema.json
84      - echo "Generated schema.json"
85    generates:
86      - schema.json