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
func (u *userRepo)Info(ctx context.Context) error { return errors.WithCode(code.ErrDatabase, "data 层 user info 操作失败%s","test") }
fmt.Println(fmt.Sprintf("== == %s", err)) 输出的日志是空的
因为你用的是%s打印,他会默认调用err的Error函数,所以打印出来的不是你上面“"data 层 user info 操作失败%s","test"”这段内容,应该是你”code.ErrDatabase“,注册的msg内容,你可以检查一下这块有没有问题。
func (u *userRepo)Info(ctx context.Context) error { return errors.WithCode(code.ErrDatabase, "data 层 user info 操作失败%s","test") }
fmt.Println(fmt.Sprintf("== == %s", err))
输出的日志是空的
The text was updated successfully, but these errors were encountered: