On Wed, Aug 2, 2017 at 11:36 AM, yihao yang <yangyihao1...@gmail.com> wrote: > > I found it is very difficult to judge an error in golang. For example, if I > want to judge a specific error returned by a function, but sometimes the > error is just newed by errors.New(xxx). > In those situations, should I just compare the error string to know what's > the exact error? Is that a go-way to do so? I'm a little confused.
I don't think there is any one answer at this point. A couple of things to read: https://blog.golang.org/errors-are-values https://dave.cheney.net/2016/04/27/dont-just-check-errors-handle-them-gracefully Ian -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.