- tools/{uuid,md5,random,time,ip}/index.go → 对应 <功能名>.go(git mv 保留历史)
- 目录名=包名=文件名三一致,扩展时目录内按功能加文件(ocr.go → + idcard.go + invoice.go)
- doc.go / AGENTS.md / PROJECT_STRUCTURE.md 同步规则说明
- 冒烟测试 5 端点全部通过
19 lines
900 B
Go
19 lines
900 B
Go
// Package tools hosts the open API tool endpoints (GET/POST /tools/*).
|
|
//
|
|
// Naming rule: every sub-feature gets its own directory under tools/, named
|
|
// after the feature (dir name = package name), and the Req/Res contracts live
|
|
// in a file named after the feature inside that directory, e.g.
|
|
//
|
|
// api/open/v1/tools/uuid/uuid.go - GET /tools/uuid
|
|
// api/open/v1/tools/md5/md5.go - POST /tools/md5
|
|
// api/open/v1/tools/random/random.go - GET /tools/random
|
|
// api/open/v1/tools/time/time.go - GET /tools/time
|
|
// api/open/v1/tools/ip/ip.go - GET /tools/ip
|
|
//
|
|
// As a feature grows, add more files inside its directory (e.g. idcard.go,
|
|
// invoice.go under ocr/) instead of bloating the starting file.
|
|
//
|
|
// Add a new feature by creating tools/<name>/<name>.go and a matching method
|
|
// in internal/controller/open/<name>.go; the router binds it automatically.
|
|
package tools
|