Skip to content

Commit 63ee6ac

Browse files
committed
chore: configure Claude Code with Go development hooks
1 parent a02a8b5 commit 63ee6ac

1 file changed

Lines changed: 21 additions & 0 deletions

File tree

.claude/settings.json

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
{
2+
"hooks": {
3+
"PostToolUse": [
4+
{
5+
"matcher": "Write|Edit",
6+
"hooks": [
7+
{
8+
"type": "command",
9+
"command": "jq -r '.tool_input.file_path' | { read -r f; case \"$f\" in *.go) gofmt -w \"$f\";; esac; } 2>/dev/null || true",
10+
"statusMessage": "Running gofmt..."
11+
},
12+
{
13+
"type": "command",
14+
"command": "jq -r '.tool_input.file_path' | { read -r f; case \"$f\" in *.go) output=$(golangci-lint run \"$f\" 2>&1); rc=$?; if [ $rc -ne 0 ]; then jq -n --arg ctx \"golangci-lint found issues in $f. Fix them:\\n$output\" '{\"hookSpecificOutput\":{\"hookEventName\":\"PostToolUse\",\"additionalContext\":$ctx}}'; exit $rc; fi;; esac; }",
15+
"statusMessage": "Running golangci-lint..."
16+
}
17+
]
18+
}
19+
]
20+
}
21+
}

0 commit comments

Comments
 (0)