I've had some ongoing confusion about using errors.As (see https://play.golang.com/p/m4_cXCzOViD). The issue I'm having is this part of the contract:
> An error matches target if the error's concrete value is assignable to the value pointed to by target I always expected (yes, I know), that base and pointer receivers are interchangeable. This is not the case (see playground). This seems to make using it error-prone as you'll always need to carefully think about the return type of the function invoked. While the contract is always error, a function may return a base or a pointer error type. This influences how using errors.As must be done. Are there best practices for: - return base vs. pointer errors - crafting the errors.As target type without inspecting the actual function invoked ...and could it make sense to lessen errors.As to match pointer with non-pointer receivers? Thanks! -- 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. To view this discussion visit https://groups.google.com/d/msgid/golang-nuts/afe2df8a-9e42-4511-abe6-8e03b906d637n%40googlegroups.com.