timenow

package
v0.13.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 29, 2026 License: MIT Imports: 6 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

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

View Source
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.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL