Skip to content

Commit f9c9402

Browse files
committed
Replaced github.com/pkg/errors with stdlib
1 parent f6874ea commit f9c9402

File tree

8 files changed

+17
-16
lines changed

8 files changed

+17
-16
lines changed

driver/sql/postgres/advisory_lock_aggregate_projection_storage.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,12 @@ package postgres
33
import (
44
"context"
55
"database/sql"
6+
"errors"
67
"fmt"
78
"strings"
89

910
"github.com/hellofresh/goengine"
1011
driverSQL "github.com/hellofresh/goengine/driver/sql"
11-
"github.com/pkg/errors"
1212
)
1313

1414
var _ driverSQL.AggregateProjectorStorage = &AdvisoryLockAggregateProjectionStorage{}

driver/sql/projection.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,11 @@ package sql
33
import (
44
"context"
55
"database/sql"
6+
"errors"
67
"time"
78

89
"github.com/mailru/easyjson/jlexer"
910
"github.com/mailru/easyjson/jwriter"
10-
"github.com/pkg/errors"
1111

1212
"github.com/hellofresh/goengine"
1313
)
@@ -37,7 +37,7 @@ type (
3737

3838
// ProjectionStateSerialization is an interface describing how a projection state can be initialized, serialized/encoded anf deserialized/decoded
3939
ProjectionStateSerialization interface {
40-
// init initializes the state
40+
// Init initializes the state
4141
Init(ctx context.Context) (interface{}, error)
4242

4343
// DecodeState reconstitute the projection state based on the provided state data
@@ -156,7 +156,7 @@ type nopProjectionStateSerialization struct {
156156
}
157157

158158
// DecodeState reconstitute the projection state based on the provided state data
159-
func (nopProjectionStateSerialization) DecodeState(data []byte) (interface{}, error) {
159+
func (nopProjectionStateSerialization) DecodeState([]byte) (interface{}, error) {
160160
return nil, nil
161161
}
162162

driver/sql/projection_notification_processor.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,11 @@ package sql
22

33
import (
44
"context"
5+
"errors"
56
"runtime"
67
"sync"
78

89
"github.com/hellofresh/goengine"
9-
"github.com/pkg/errors"
1010
)
1111

1212
type (

driver/sql/projector_notification.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,10 @@ package sql
33
import (
44
"context"
55
"database/sql"
6+
"errors"
7+
"fmt"
68

79
"github.com/hellofresh/goengine"
8-
"github.com/pkg/errors"
910
)
1011

1112
// Ensure the notificationProjector.Execute is a ProjectionTrigger
@@ -210,7 +211,7 @@ func wrapProjectionHandlerToTrapError(handler goengine.MessageHandler) goengine.
210211
case error:
211212
err = x
212213
default:
213-
err = errors.Errorf("unknown panic: (%T) %v", x, x)
214+
err = fmt.Errorf("unknown panic: (%T) %v", x, x)
214215
}
215216

216217
handlerErr = NewProjectionHandlerError(err)

driver/sql/projector_notification_test.go

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,14 @@ package sql
44

55
import (
66
"context"
7+
"errors"
78
"testing"
89

9-
"github.com/hellofresh/goengine"
10-
"github.com/hellofresh/goengine/aggregate"
11-
"github.com/pkg/errors"
1210
"github.com/stretchr/testify/assert"
1311
"github.com/stretchr/testify/require"
12+
13+
"github.com/hellofresh/goengine"
14+
"github.com/hellofresh/goengine/aggregate"
1415
)
1516

1617
func TestWrapProjectionHandlerToTrapError(t *testing.T) {

driver/sql/projector_stream.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,11 @@ package sql
33
import (
44
"context"
55
"database/sql"
6+
"fmt"
67
"math"
78
"sync"
89

910
"github.com/hellofresh/goengine"
10-
"github.com/pkg/errors"
1111
)
1212

1313
// StreamProjector is a postgres projector used to execute a projection against an event stream.
@@ -149,8 +149,8 @@ func (s *StreamProjector) processNotification(
149149
}
150150
}
151151

152-
return errors.Errorf(
153-
"seriously %d retries is enough! maybe it's time to fix your projection or error handling code?",
152+
return fmt.Errorf(
153+
"seriously %d retries is enough! maybe it's time to fix your projection or error handling code",
154154
math.MaxInt16,
155155
)
156156
}

go.mod

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ require (
88
github.com/google/uuid v1.3.0
99
github.com/lib/pq v1.10.2
1010
github.com/mailru/easyjson v0.7.7
11-
github.com/pkg/errors v0.9.1
1211
github.com/prometheus/client_golang v1.11.0
1312
github.com/sirupsen/logrus v1.8.1
1413
github.com/streadway/amqp v1.0.0

metadata/metadata.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,11 @@ package metadata
22

33
import (
44
"encoding/json"
5+
"fmt"
56

67
"github.com/mailru/easyjson"
78
"github.com/mailru/easyjson/jlexer"
89
"github.com/mailru/easyjson/jwriter"
9-
"github.com/pkg/errors"
1010
)
1111

1212
type (
@@ -214,7 +214,7 @@ func marshalJSONKeyValues(out *jwriter.Writer, parent Metadata) {
214214

215215
plen := len(parentJSON)
216216
if parentJSON[1] != '{' || parentJSON[plen-1] != '}' {
217-
out.Raw(parentJSON, errors.Errorf("JSON unmarshal failed for Metadata of type %T", parent))
217+
out.Raw(parentJSON, fmt.Errorf("JSON unmarshal failed for Metadata of type %T", parent))
218218
return
219219
}
220220

0 commit comments

Comments
 (0)