errcmp

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 errcmp 禁止通过 err.Error() 字符串比对做错误分支判定。

appkit 的错误身份是错误码(*apperr.Error),跨层与跨进程判定必须用 apperr.Is(err, code) 或标准库 errors.Is / errors.As;对 err.Error() 做 == / != / strings.Contains / HasPrefix / HasSuffix / EqualFold 比对既脆弱 又会在文案或包装变化后静默失效(见 AGENTS.md「惯用法」)。 日志记录、序列化或拼接输出里的 err.Error() 不受影响。

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

Index

Constants

This section is empty.

Variables

View Source
var Analyzer = &analysis.Analyzer{
	Name: "errcmp",
	Doc:  "禁止对 error.Error() 结果做字符串比较(== / != / strings.Contains 等);错误判定请使用 apperr.Is 或 errors.Is / errors.As",
	Run:  run,
}

Analyzer 是 errcmp 检查器。

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