It seems that something about the way the error interface is designed is not intuitive enough for some, because a number of people on the IRC channel keep coming up asking what the best way to check for a specific error is — and their first instinct is to scan the contents of the string returned by the Error() method, which is wrong.
I'm not sure how to solve this problem once and for all, but we could probably bandage it by having vet report such misuse. A basic implementation would be something like if err.Error() == "file not found" { // vet should say that is not how to identify an error // slightly smarter: suggest to use os.IsNotExist(err) } How feasible is this? Is catching all possible variations of this mistake too difficult of a problem to solve? Is there a better way? -- 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.