This repository has been archived on 2026-02-17. You can view files and clone it, but cannot push or open issues or pull requests.
core-claude/scripts/go-format.sh
Snider 0a89ac91d1 feat: initial Claude Code plugin for host-uk monorepo
- Skills for core CLI, PHP, and Go patterns
- PreToolUse hooks to block destructive commands and enforce core CLI
- PreCompact/SessionStart hooks for context preservation
- PostToolUse hooks for auto-formatting and debug warnings
- /core:remember command for manual context capture

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-01 02:36:33 +00:00

19 lines
595 B
Bash
Executable file

#!/bin/bash
# Auto-format Go files after edits using core go fmt
read -r input
FILE_PATH=$(echo "$input" | jq -r '.tool_input.file_path // empty')
if [[ -n "$FILE_PATH" && -f "$FILE_PATH" ]]; then
# Run gofmt/goimports on the file silently
if command -v core &> /dev/null; then
core go fmt --fix "$FILE_PATH" 2>/dev/null || true
elif command -v goimports &> /dev/null; then
goimports -w "$FILE_PATH" 2>/dev/null || true
elif command -v gofmt &> /dev/null; then
gofmt -w "$FILE_PATH" 2>/dev/null || true
fi
fi
# Pass through the input
echo "$input"