Repository navigation
Expand file tree
/
Copy pathTaskfile.yml
More file actions
153 lines (128 loc) · 3.45 KB
/
Copy pathTaskfile.yml
File metadata and controls
153 lines (128 loc) · 3.45 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
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
version: "3"
vars:
BINARY_NAME: godebug
BUILD_DIR: ./bin
MAIN_PKG: .
LDFLAGS: -s -w
tasks:
default:
desc: Build the binary
cmds:
- task: build
_ensure-build-dir:
internal: true
cmds:
- mkdir -p {{.BUILD_DIR}}
status:
- test -d {{.BUILD_DIR}}
build:
desc: Build the binary
deps: [_ensure-build-dir]
cmds:
- go build -ldflags "{{.LDFLAGS}}" -o {{.BUILD_DIR}}/{{.BINARY_NAME}} {{.MAIN_PKG}}
sources:
- "**/*.go"
- go.mod
- go.sum
generates:
- "{{.BUILD_DIR}}/{{.BINARY_NAME}}"
build:dev:
desc: Build with debug symbols (for development)
deps: [_ensure-build-dir]
cmds:
- go build -o {{.BUILD_DIR}}/{{.BINARY_NAME}} {{.MAIN_PKG}}
install:
desc: Install binary to GOPATH/bin
cmds:
- go install -ldflags "{{.LDFLAGS}}" {{.MAIN_PKG}}
test:
desc: Run all tests
cmds:
- go test -v -race ./...
test:short:
desc: Run tests in short mode
cmds:
- go test -short ./...
test:cover:
desc: Run tests with coverage
cmds:
- go test -race -coverprofile=coverage.out -covermode=atomic ./...
- go tool cover -html=coverage.out -o coverage.html
generates:
- coverage.out
- coverage.html
lint:
desc: Run golangci-lint
cmds:
- golangci-lint run
lint:fix:
desc: Run golangci-lint with auto-fix
cmds:
- golangci-lint run --fix
fmt:
desc: Format code
cmds:
- gofmt -s -w .
- goimports -w -local github.com/8gears/godebug-agentic .
tidy:
desc: Tidy go modules
cmds:
- go mod tidy
clean:
desc: Remove build artifacts
cmds:
- rm -rf {{.BUILD_DIR}}
- rm -f coverage.out coverage.html
verify:
desc: Run all verification (lint, test, build)
cmds:
- task: tidy
- task: lint
- task: test
- task: build
run:
desc: Build and run with arguments
cmds:
- task: build
- "{{.BUILD_DIR}}/{{.BINARY_NAME}} {{.CLI_ARGS}}"
# Integration test helpers
test:integration:
desc: Run a quick integration test
cmds:
- task: build
- |
echo "Starting debug session..."
ADDR=$({{.BUILD_DIR}}/{{.BINARY_NAME}} start ./testdata/debugme | jq -r '.data.addr')
if [ -z "$ADDR" ] || [ "$ADDR" = "null" ]; then
echo "Failed to start debug session"
exit 1
fi
echo "Debug server at: $ADDR"
echo "Setting breakpoint..."
{{.BUILD_DIR}}/{{.BINARY_NAME}} --addr $ADDR break testdata/debugme/main.go:7
echo "Continuing to breakpoint..."
{{.BUILD_DIR}}/{{.BINARY_NAME}} --addr $ADDR continue
echo "Getting locals..."
{{.BUILD_DIR}}/{{.BINARY_NAME}} --addr $ADDR locals
echo "Checking stack..."
{{.BUILD_DIR}}/{{.BINARY_NAME}} --addr $ADDR stack
echo "Quitting..."
{{.BUILD_DIR}}/{{.BINARY_NAME}} --addr $ADDR quit
echo "Integration test passed!"
build:examples:
desc: Build all concurrency bug examples with debug flags
deps: [_ensure-build-dir]
vars:
EXAMPLES_DIR: ./testdata/concurrency_bugs
cmds:
- |
for dir in {{.EXAMPLES_DIR}}/*/; do
name=$(basename "$dir")
echo "Building $name..."
go build -gcflags="all=-N -l" -o {{.BUILD_DIR}}/$name "$dir"
done
- echo "Built examples in {{.BUILD_DIR}}/"
help:
desc: Show available commands
cmds:
- task --list