From 9c841c83d446e200c6da6a9b2f2c0e8d76d964bb Mon Sep 17 00:00:00 2001 From: Madhu Rajanna Date: Fri, 21 Jan 2022 15:12:35 +0530 Subject: [PATCH] cleanup: rename errorPair to pairError to fix the errname check renaming the struct. Signed-off-by: Madhu Rajanna --- internal/util/errors.go | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/internal/util/errors.go b/internal/util/errors.go index 29918fc29..795e6630b 100644 --- a/internal/util/errors.go +++ b/internal/util/errors.go @@ -39,27 +39,27 @@ var ( ErrMissingConfigForMonitor = errors.New("missing configuration of cluster ID for monitor") ) -type errorPair struct { +type pairError struct { first error second error } -func (e errorPair) Error() string { +func (e pairError) Error() string { return fmt.Sprintf("%v: %v", e.first, e.second) } // Is checks if target error is wrapped in the first error. -func (e errorPair) Is(target error) bool { +func (e pairError) Is(target error) bool { return errors.Is(e.first, target) } // Unwrap returns the second error. -func (e errorPair) Unwrap() error { +func (e pairError) Unwrap() error { return e.second } // JoinErrors combines two errors. Of the returned error, Is() follows the first // branch, Unwrap() follows the second branch. func JoinErrors(e1, e2 error) error { - return errorPair{e1, e2} + return pairError{e1, e2} }