Documentation
¶
Overview ¶
Package timenow 在显式圈定的核心业务包中禁止直接调用 time.Now()。
账务、计费、过期判定等需要确定性单测的核心业务包应注入时钟(now func() time.Time), 而不是散落调用全局 time.Now()。
注意:为避免对日志/基础设施/普通工具包产生噪音,本检查器默认关闭(-scope 为空时不检查), 仅在显式指定 `-timenow.scope=<正则>` 时对匹配的包生效(如 `-timenow.scope='^github\.com/forgeplex/ledger/internal/ledger'`)。
默认只查非生成生产代码(_test.go 与生成文件不查),-tests=true 连测试一起查。
Index ¶
Constants ¶
This section is empty.
Variables ¶
var Analyzer = &analysis.Analyzer{
Name: "timenow",
Doc: "在 -timenow.scope 圈定的核心业务包中禁止直接调用 time.Now(),强制注入时钟以保证确定性单测(-scope 为空时默认不启用)",
Run: run,
}
Analyzer 是 timenow 检查器。
Functions ¶
This section is empty.
Types ¶
This section is empty.