From 4b9cda815aa2612789543484d4e29855c791eeeb Mon Sep 17 00:00:00 2001 From: Kale Blankenship Date: Wed, 25 Jul 2018 17:34:09 -0700 Subject: [PATCH] Return `*DetachError` instead of `DetachError` This works as a pointer or non-pointer, but it's easier to enforce consistency by fulfilling the error interface with a pointer receiver. --- client.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/client.go b/client.go index c378de49..4a4e62c5 100644 --- a/client.go +++ b/client.go @@ -774,7 +774,7 @@ type DetachError struct { RemoteError *Error } -func (e DetachError) Error() string { +func (e *DetachError) Error() string { return fmt.Sprintf("link detached, reason: %+v", e.RemoteError) } @@ -1198,7 +1198,7 @@ func (l *link) muxHandleFrame(fr frameBody) error { // set detach received and close link l.detachReceived = true - return errorWrapf(DetachError{fr.Error}, "received detach frame") + return errorWrapf(&DetachError{fr.Error}, "received detach frame") case *performDisposition: debug(3, "RX: %s", fr)