-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
gerror.NewCode has different returns in different gf versions #3699
Comments
See: #3640 |
不好意思,那我想咨询一下,以下结果对你们来说是预期内的吗,因为我们之前使用2.7.0和2.7.1版本,有一些就是使用的这种错误判断,判断结果都是true。但是使用的后续2.7.2,判断结果都是false,那可能我需要做一些修改 # 2.7.2
var err1 = gerror.NewCode(gcode.New(1000, "测试", nil), "测试")
var err2 = gerror.NewCode(gcode.New(1000, "测试", nil), "测试")
fmt.Println(errors.Is(err1, err2)) // return false |
Sorry, I would like to ask. The following results are expected, because we used version 2.7.0 before, and some of them used this kind of wrong judgment, and the judgment results were all true. If the judgment results are false in subsequent 2.7.2 and later versions, then I may need to make some modifications. # 2.7.2
var err1 = gerror.NewCode(gcode.New(1000, "test", nil), "test")
var err2 = gerror.NewCode(gcode.New(1000, "test", nil), "test")
fmt.Println(errors.Is(err1, err2)) // return false |
我看了这个pr,但是pr内容是修改的gerror.Is 方法,我是直接使用的errors.Is方法判断的 |
I read this pr, but the pr content is the modified gerror.Is method. I directly use the errors.Is method to judge. |
从逻辑上来说,是符合预期,因为你初始化 gerror 时, See: gf/errors/gerror/gerror_error.go Line 107 in ba322ba
如果两个 code 完全一致,你应该可以尝试使用 |
Logically speaking, it is in line with expectations, because when you initialize gerror, See: gf/errors/gerror/gerror_error.go Line 107 in ba322ba
If the two codes are exactly the same, you should try using |
Go version
go version go1.22.0 darwin/arm64
GoFrame version
2.7.2
Can this bug be reproduced with the latest release?
Option Yes
What did you do?
What did you see happen?
在2.7.0版本和2.7.2版本表现有差异
What did you expect to see?
在2.7.0版本和2.7.2版本应该都返回true
The text was updated successfully, but these errors were encountered: