From b066838f0327bbee09214a4a036acec39bc468bf Mon Sep 17 00:00:00 2001 From: Joonsoo Park Date: Wed, 8 May 2024 01:05:37 +0900 Subject: [PATCH] [chore][receiver/datadogreceiver] use errors.Join instead of go.uber.org/multierr (#32509) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit **Description:** use errors.Join instead of go.uber.org/multierr **Link to tracking Issue:** #25121 **Testing:** **Documentation:** Co-authored-by: Juraci Paixão Kröhling --- receiver/datadogreceiver/go.mod | 2 +- receiver/datadogreceiver/receiver_test.go | 4 ++-- receiver/datadogreceiver/translator.go | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/receiver/datadogreceiver/go.mod b/receiver/datadogreceiver/go.mod index ec718b41a1eb..1db8ea78ae5a 100644 --- a/receiver/datadogreceiver/go.mod +++ b/receiver/datadogreceiver/go.mod @@ -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 ) @@ -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 diff --git a/receiver/datadogreceiver/receiver_test.go b/receiver/datadogreceiver/receiver_test.go index 906073866a36..1b8128432824 100644 --- a/receiver/datadogreceiver/receiver_test.go +++ b/receiver/datadogreceiver/receiver_test.go @@ -5,6 +5,7 @@ package datadogreceiver import ( "context" + "errors" "fmt" "io" "net/http" @@ -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) { @@ -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") diff --git a/receiver/datadogreceiver/translator.go b/receiver/datadogreceiver/translator.go index 113b25841cc3..3c7ac3fae026 100644 --- a/receiver/datadogreceiver/translator.go +++ b/receiver/datadogreceiver/translator.go @@ -7,6 +7,7 @@ import ( "bytes" "encoding/binary" "encoding/json" + "errors" "io" "mime" "net/http" @@ -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" ) @@ -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 {