You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Issues-translate-bot
changed the title
errors/gerror: gerror的Is()方法的判断结果有点反直觉
errors/gerror: The judgment result of gerror's Is() method is a bit counter-intuitive
Jun 5, 2024
Go version
go version go1.22.3 windows/amd64
GoFrame version
2.7.1
Can this bug be reproduced with the latest release?
Option Yes
What did you do?
这是gerror的源码部分:
func Is(err, target error) bool {
if e, ok := err.(IIs); ok {
return e.Is(target)
}
return false
}
由于标准库错误没有实现IIs接口,导致这里的判断直接变成false了。
参考下面的标准库的错误包 与 github.com/pkg/errors包的 判断对比。
What did you see happen?
我预期与标准库的errors.Is判断结果一致
What did you expect to see?
结果相反
这是复现示例代码:
The text was updated successfully, but these errors were encountered: