canonicalmoney

package
v0.13.1 Latest Latest
Warning

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

Go to latest
Published: Nov 29, 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 canonicalmoney 禁止在 HTTP 入站边界直接使用 decimal.NewFromString / decimal.RequireFromString 解析金额字符串。

decimal.NewFromString 接受 "+80"、"080"、"8e1"、"-0" 等非规范形态,会破坏 幂等指纹与请求签名的一致性;HTTP 入站(internal/http)必须统一走 money.ParseCanonical 或 money.ParseCanonicalDecimal。

默认仅对路径匹配 `/internal/http($|/)` 的包生效(可通过 `-canonicalmoney.scope` 覆盖), 且默认只查非生成生产代码(_test.go 与生成文件不查)。

Index

Constants

This section is empty.

Variables

View Source
var Analyzer = &analysis.Analyzer{
	Name: "canonicalmoney",
	Doc:  "禁止在 HTTP 入站层(internal/http)直接调用 decimal.NewFromString/RequireFromString;请改用 money.ParseCanonical 或 money.ParseCanonicalDecimal",
	Run:  run,
}

Analyzer 是 canonicalmoney 检查器。

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