diff --git a/pkg/object/error.go b/pkg/object/error.go index 98bd3f22..96048c28 100644 --- a/pkg/object/error.go +++ b/pkg/object/error.go @@ -6,14 +6,14 @@ type SplitInfoError struct { const splitInfoErrorMsg = "object not found, split info has been provided" -func (s SplitInfoError) Error() string { +func (s *SplitInfoError) Error() string { return splitInfoErrorMsg } -func (s SplitInfoError) SplitInfo() *SplitInfo { +func (s *SplitInfoError) SplitInfo() *SplitInfo { return s.si } -func NewSplitInfoError(v *SplitInfo) SplitInfoError { - return SplitInfoError{si: v} +func NewSplitInfoError(v *SplitInfo) *SplitInfoError { + return &SplitInfoError{si: v} } diff --git a/pkg/object/error_test.go b/pkg/object/error_test.go index ce3bcd22..870c2d67 100644 --- a/pkg/object/error_test.go +++ b/pkg/object/error_test.go @@ -12,12 +12,13 @@ func TestNewSplitInfoError(t *testing.T) { var ( si = generateSplitInfo() - err error = object.NewSplitInfoError(si) + err error = object.NewSplitInfoError(si) + expectedErr *object.SplitInfoError ) - require.True(t, errors.As(err, new(object.SplitInfoError))) + require.True(t, errors.As(err, &expectedErr)) - siErr, ok := err.(object.SplitInfoError) + siErr, ok := err.(*object.SplitInfoError) require.True(t, ok) require.Equal(t, si, siErr.SplitInfo()) }