.golangci.yml:
- 启用 linter: errcheck, gosec, govet, staticcheck, ineffassign, unused,
revive, contextcheck, errorlint, errname, misspell
- 启用 formatter: gofumpt + goimports
Makefile:
- fmt/fmt-check: gofumpt + goimports 格式检查
- lint/lint-strict: golangci-lint 报告/阻断模式
- test: go test -race
- ci: 完整 CI 流程 (fmt-check + lint)
docs/code-style.md:
- 新增 AI 执行协议 + 代码格式化/自动化检查/MUST规则
- 集成 golangci-lint 检查项与规范对照
13 lines
296 B
Bash
13 lines
296 B
Bash
#!/bin/bash
|
||
# Git pre-push hook — push 前跑 CI 检查
|
||
# 安装:cp scripts/pre-push .git/hooks/pre-push && chmod +x .git/hooks/pre-push
|
||
|
||
set -euo pipefail
|
||
|
||
ROOT="$(cd "$(dirname "$0")/../.." && pwd)"
|
||
|
||
echo ""
|
||
echo "==> Pre-push CI check..."
|
||
bash "$ROOT/scripts/ci.sh" --strict
|
||
echo "==> OK"
|