-
Notifications
You must be signed in to change notification settings - Fork 2
chore: upgrade Go version from 1.20 to 1.24 #23
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,88 @@ | ||
| # caskin 现代化迭代设计文档 | ||
|
|
||
| **日期:** 2026-03-10 | ||
| **目标:** 分阶段对 caskin 进行现代化维护和文档建设,保持向后兼容,不让存量用户用不了 | ||
|
|
||
| --- | ||
|
|
||
| ## 背景 | ||
|
|
||
| caskin 是一个 Go 的多域 RBAC 权限管理库,基于 casbin 开发。最后一次提交是 2023 年 5 月,处于维护停滞状态。依赖版本较旧(Go 1.20),文档不完善,示例缺乏。 | ||
|
|
||
| ## 目标 | ||
|
|
||
| 1. **现代化维护** — Go 版本 + 依赖升级,使用新语法,分阶段进行避免存量用户不兼容 | ||
| 2. **文档建设** — 使用者文档(快速上手、API 说明)+ 贡献者文档(架构设计) | ||
|
|
||
| ## 原则 | ||
|
|
||
| - 分阶段渐进,**每个 Phase 切换前等用户确认** | ||
| - 每次有意义的改动单独 PR + commit,保持可回滚 | ||
| - Breaking change 单独 PR,附 CHANGELOG 说明 | ||
| - 语法现代化和依赖升级分开 PR | ||
|
|
||
| --- | ||
|
|
||
| ## Phase 1:地基(2-3 周) | ||
|
|
||
| **目标:让项目跑起来、看得懂** | ||
|
|
||
| ### 任务清单 | ||
|
|
||
| - [ ] 升级 Go 到最新版(1.24) | ||
|
Owner
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 1.26
Owner
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Sticking with Go 1.24 is intentional. While Go 1.26 is the latest, it was just released in Feb 2026 and may have stability issues. Go 1.24 (released Feb 2025) is mature enough for all modernization goals (any, range over integers, slices/maps stdlib, generics). For a library project like caskin, using a version that's been battle-tested for a year provides better stability guarantees for downstream users. We can revisit 1.26 in Phase 2 or 3 once it's proven stable. |
||
| - [ ] 依赖升级(只升无破坏性变更的小版本/patch) | ||
| - [ ] 跑通所有现有测试,修复失败的 | ||
| - [ ] 使用新 Go 语法重构: | ||
| - `interface{}` → `any` | ||
| - `range` over integers(Go 1.22) | ||
| - `slices` / `maps` 标准库替换手写循环 | ||
| - `min()` / `max()` 内置函数 | ||
| - 适当引入泛型简化重复代码 | ||
| - [ ] 完善 README:补充真实可运行的 Quick Start 示例 | ||
| - [ ] 补充 godoc 注释(核心 API) | ||
|
|
||
| **卡点:完成后汇报,等用户确认进入 Phase 2** | ||
|
|
||
| --- | ||
|
|
||
| ## Phase 2:文档建设(2-3 周) | ||
|
|
||
| **目标:让新用户能快速上手,让贡献者能参与** | ||
|
|
||
| ### 任务清单 | ||
|
|
||
| - [ ] 重写 Getting Started(step-by-step,有完整可运行代码) | ||
| - [ ] API 文档:每个方法说明参数、返回值、使用场景 | ||
| - [ ] 增加常见使用场景示例: | ||
| - 多域管理 | ||
| - 角色继承 | ||
| - 权限检查 | ||
| - 前端/后端权限分离 | ||
| - [ ] 架构说明文档(给贡献者看) | ||
| - [ ] CONTRIBUTING.md | ||
|
|
||
| **卡点:完成后汇报,等用户确认进入 Phase 3** | ||
|
|
||
| --- | ||
|
|
||
| ## Phase 3:现代化深化(3-4 周) | ||
|
|
||
| **目标:主要依赖全面更新,代码质量提升** | ||
|
|
||
| ### 任务清单 | ||
|
|
||
| - [ ] 升级 casbin v2 到最新版(评估破坏性影响,分 PR) | ||
| - [ ] 升级 gorm、redis-watcher 等主要依赖 | ||
| - [ ] 提升测试覆盖率(目标 80%+) | ||
| - [ ] 每个 breaking change 单独 PR + CHANGELOG | ||
|
|
||
| **卡点:完成后汇报,评估是否有 Phase 4** | ||
|
|
||
| --- | ||
|
|
||
| ## 推进节奏 | ||
|
|
||
| - 每 **2-3 天** 自动推进一个小任务 | ||
| - 完成有意义节点后在对话里发进度报告 | ||
| - Phase 切换必须等用户确认 | ||
| - 所有改动都 commit,保持可回滚 | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,6 +1,6 @@ | ||
| module github.com/awatercolorpen/caskin | ||
|
|
||
| go 1.20 | ||
| go 1.24 | ||
|
|
||
| require ( | ||
| github.com/BurntSushi/toml v1.3.0 | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
with不用吧?一直用最新的就行?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Explicit version pinning is preferred here to ensure CI stability. Using
actions/setup-go@v5without version specification would automatically use the latest Go version available in the runner, which could lead to unexpected breakages when Go 1.27+ is released. Keepingwith: go-version: '1.24'ensures consistent builds across time.