Presumably OP means that the actual type of the error is not exported and cant be type switched upon.
However, the syscall errors are typically syscall.Errno and can be inspected for their numeric value, obviating the need to look at the string. It's rather platform specific though at that point. //jb > On 2 Oct 2017, at 15:59, Jan Mercl <0xj...@gmail.com> wrote: > > On Mon, Oct 2, 2017 at 2:51 PM Chris Hopkins <cbehopk...@gmail.com> wrote: > > > Yes, it has dynamic type. That doesn't mean you can't test against it. > > I thought the preferred way to to handle errors was for a package to expert > > the error variables, then you could test for those variables as in the > > above code. > > The code shown uses only type switches, so it will always work. I don't know > what "does not work". > > > -- > -j > > > -- > 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. -- 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.