chore: Add pre-commit blocker report and improve Go version management
- Created a comprehensive pre-commit blocker report detailing GolangCI-Lint and TypeScript type check failures, including remediation steps and verification commands. - Enhanced the golangci-lint pre-commit hook to automatically rebuild the tool if a Go version mismatch is detected. - Introduced a new script `rebuild-go-tools.sh` to rebuild essential Go development tools, ensuring they are compiled with the current Go version. - Improved error handling and user feedback in the rebuilding process, providing clear instructions for manual intervention if needed. - Updated supervisor review report to reflect the successful implementation of Go version management and associated documentation.
This commit is contained in:
@@ -40,6 +40,35 @@ if [[ -z "$GOLANGCI_LINT" ]]; then
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Version compatibility check
|
||||
# Extract Go versions from golangci-lint and system Go
|
||||
LINT_GO_VERSION=$("$GOLANGCI_LINT" version 2>/dev/null | grep -oP 'go\K[0-9]+\.[0-9]+(?:\.[0-9]+)?' || echo "")
|
||||
SYSTEM_GO_VERSION=$(go version 2>/dev/null | grep -oP 'go\K[0-9]+\.[0-9]+(?:\.[0-9]+)?' || echo "")
|
||||
|
||||
if [[ -n "$LINT_GO_VERSION" && -n "$SYSTEM_GO_VERSION" && "$LINT_GO_VERSION" != "$SYSTEM_GO_VERSION" ]]; then
|
||||
echo "⚠️ golangci-lint Go version mismatch detected:"
|
||||
echo " golangci-lint: $LINT_GO_VERSION"
|
||||
echo " system Go: $SYSTEM_GO_VERSION"
|
||||
echo ""
|
||||
echo "🔧 Auto-rebuilding golangci-lint with current Go version..."
|
||||
|
||||
if go install github.com/golangci/golangci-lint/cmd/golangci-lint@latest 2>&1; then
|
||||
echo "✅ golangci-lint rebuilt successfully"
|
||||
|
||||
# Re-verify the tool is still accessible
|
||||
if command -v golangci-lint >/dev/null 2>&1; then
|
||||
GOLANGCI_LINT="golangci-lint"
|
||||
else
|
||||
GOLANGCI_LINT="$HOME/go/bin/golangci-lint"
|
||||
fi
|
||||
else
|
||||
echo "❌ Failed to rebuild golangci-lint"
|
||||
echo " Please run manually: go install github.com/golangci/golangci-lint/cmd/golangci-lint@latest"
|
||||
exit 1
|
||||
fi
|
||||
echo ""
|
||||
fi
|
||||
|
||||
# Change to backend directory and run golangci-lint
|
||||
cd "$(dirname "$0")/../../backend" || exit 1
|
||||
exec "$GOLANGCI_LINT" run --config .golangci-fast.yml ./...
|
||||
|
||||
Reference in New Issue
Block a user