You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Claude Code gofmt hook never runs: $CLAUDE_FILE_PATHS is not set (same in conforma/policy) #3601
The PostToolUse hook in .claude/settings.json reads $CLAUDE_FILE_PATHS, which Claude Code doesn't set: the tool call arrives as JSON on stdin, with the path at tool_input.file_path (hooks reference: https://code.claude.com/docs/en/hooks). So f is always empty and gofmt never runs on a file Claude edits.
Fix (needs jq):
"command": "f=$(jq -r '.tool_input.file_path // empty'); case \"$f\" in *.go) gofmt -w \"$f\" 2>/dev/null;; esac"
Tested with the JSON Claude Code sends for an Edit to cmd/main.go: before, nothing runs; after, gofmt -w runs on that file, and a .md edit still runs nothing.
conforma/policy has the same pattern for .rego files, so make fmt never runs there either. The same change works:
"command": "if jq -r '.tool_input.file_path // empty' | grep -q '\\.rego$'; then make fmt 2>/dev/null; fi"
Found this while testing Claude Code hooks for Paveo; uvx paveo doctor flags both. Happy to open a PR in each repo.
Activity