Skip to content

Commit

Permalink
use errors.Join instead of go.uber.org/multierr
Browse files Browse the repository at this point in the history
  • Loading branch information
bagmeg authored and jpkrohling committed May 7, 2024
1 parent 14d7d4d commit 261c350
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion receiver/datadogreceiver/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ require (
go.opentelemetry.io/otel/metric v1.26.0
go.opentelemetry.io/otel/trace v1.26.0
go.uber.org/goleak v1.3.0
go.uber.org/multierr v1.11.0
google.golang.org/protobuf v1.34.1
)

Expand Down Expand Up @@ -68,6 +67,7 @@ require (
go.opentelemetry.io/otel/exporters/prometheus v0.48.0 // indirect
go.opentelemetry.io/otel/sdk v1.26.0 // indirect
go.opentelemetry.io/otel/sdk/metric v1.26.0 // indirect
go.uber.org/multierr v1.11.0 // indirect
go.uber.org/zap v1.27.0 // indirect
golang.org/x/net v0.24.0 // indirect
golang.org/x/sys v0.19.0 // indirect
Expand Down
4 changes: 2 additions & 2 deletions receiver/datadogreceiver/receiver_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ package datadogreceiver

import (
"context"
"errors"
"fmt"
"io"
"net/http"
Expand All @@ -16,7 +17,6 @@ import (
"go.opentelemetry.io/collector/component/componenttest"
"go.opentelemetry.io/collector/consumer/consumertest"
"go.opentelemetry.io/collector/receiver/receivertest"
"go.uber.org/multierr"
)

func TestDatadogReceiver_Lifecycle(t *testing.T) {
Expand Down Expand Up @@ -81,7 +81,7 @@ func TestDatadogServer(t *testing.T) {
require.NoError(t, err, "Must not error performing request")

actual, err := io.ReadAll(resp.Body)
require.NoError(t, multierr.Combine(err, resp.Body.Close()), "Must not error when reading body")
require.NoError(t, errors.Join(err, resp.Body.Close()), "Must not error when reading body")

assert.Equal(t, tc.expectContent, string(actual))
assert.Equal(t, tc.expectCode, resp.StatusCode, "Must match the expected status code")
Expand Down
4 changes: 2 additions & 2 deletions receiver/datadogreceiver/translator.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import (
"bytes"
"encoding/binary"
"encoding/json"
"errors"
"io"
"mime"
"net/http"
Expand All @@ -18,7 +19,6 @@ import (
"go.opentelemetry.io/collector/pdata/pcommon"
"go.opentelemetry.io/collector/pdata/ptrace"
semconv "go.opentelemetry.io/collector/semconv/v1.16.0"
"go.uber.org/multierr"
"google.golang.org/protobuf/proto"
)

Expand Down Expand Up @@ -202,7 +202,7 @@ func handlePayload(req *http.Request) (tp []*pb.TracerPayload, err error) {

defer func() {
_, errs := io.Copy(io.Discard, req.Body)
err = multierr.Combine(err, errs, req.Body.Close())
err = errors.Join(err, errs, req.Body.Close())
}()

switch {
Expand Down

0 comments on commit 261c350

Please sign in to comment.