timenow

package
v0.17.2 Latest Latest
Warning

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

Go to latest
Published: Dec 5, 2026 License: MIT Imports: 7 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()。

默认仅检查 .appkit.yml 声明的业务包;-scope 可覆盖这个范围。

默认只查非生成生产代码(_test.go 与生成文件不查),-tests=true 连测试一起查。

Index

Constants

This section is empty.

Variables

View Source
var Analyzer = &analysis.Analyzer{
	Name: "timenow",
	Doc:  "在业务包或 -timenow.scope 圈定的包中禁止直接调用 time.Now(),强制注入时钟以保证确定性单测",
	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