From 99f4cca565a479589fc673d2bee46185006e82a5 Mon Sep 17 00:00:00 2001 From: Timon Ringwald Date: Mon, 19 Oct 2020 11:40:45 +0200 Subject: [PATCH] improved errors.Is implementation --- error.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/error.go b/error.go index 749d6df..6e977f0 100644 --- a/error.go +++ b/error.go @@ -75,6 +75,11 @@ func (e *Error) Is(target error) bool { return tErr.tmpl == e.tmpl } + // target is the template itself, therefore they are considered equal to another + if tTmpl, ok := target.(*ErrTmpl); ok { + return tTmpl == e.tmpl + } + return false }