From 8154201da7fb2280858e50338de06f6330a45d7e Mon Sep 17 00:00:00 2001 From: bagmeg Date: Thu, 19 Oct 2023 14:56:22 +0900 Subject: [PATCH] [chore][exporter/fileexporter] use errors.Join instead of go.uber.org/multierr (#27835) **Description:** fileexporter: use errors.Join instead of go.uber.org/multierr **Link to tracking Issue:** #25121 --- exporter/fileexporter/buffered_writer.go | 5 ++--- exporter/fileexporter/buffered_writer_test.go | 4 ++-- exporter/fileexporter/go.mod | 2 +- 3 files changed, 5 insertions(+), 6 deletions(-) diff --git a/exporter/fileexporter/buffered_writer.go b/exporter/fileexporter/buffered_writer.go index 64ee151fa217..6e50b6519296 100644 --- a/exporter/fileexporter/buffered_writer.go +++ b/exporter/fileexporter/buffered_writer.go @@ -5,9 +5,8 @@ package fileexporter // import "github.com/open-telemetry/opentelemetry-collecto import ( "bufio" + "errors" "io" - - "go.uber.org/multierr" ) // bufferedWriteCloser is intended to use more memory @@ -33,7 +32,7 @@ func (bwc *bufferedWriteCloser) Write(p []byte) (n int, err error) { } func (bwc *bufferedWriteCloser) Close() error { - return multierr.Combine( + return errors.Join( bwc.buffered.Flush(), bwc.wrapped.Close(), ) diff --git a/exporter/fileexporter/buffered_writer_test.go b/exporter/fileexporter/buffered_writer_test.go index a6512258d2fa..60f79a08a76b 100644 --- a/exporter/fileexporter/buffered_writer_test.go +++ b/exporter/fileexporter/buffered_writer_test.go @@ -5,6 +5,7 @@ package fileexporter import ( "bytes" + "errors" "fmt" "io" "os" @@ -13,7 +14,6 @@ import ( "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" - "go.uber.org/multierr" ) const ( @@ -83,7 +83,7 @@ func BenchmarkWriter(b *testing.B) { for i := 0; i < b.N; i++ { _, err = w.Write(payload) } - errBenchmark = multierr.Combine(err, w.Close()) + errBenchmark = errors.Join(err, w.Close()) }) } } diff --git a/exporter/fileexporter/go.mod b/exporter/fileexporter/go.mod index 11be5ffcb8db..6eba04c79ac8 100644 --- a/exporter/fileexporter/go.mod +++ b/exporter/fileexporter/go.mod @@ -12,7 +12,6 @@ require ( go.opentelemetry.io/collector/consumer v0.87.1-0.20231017160804-ec0725874313 go.opentelemetry.io/collector/exporter v0.87.1-0.20231017160804-ec0725874313 go.opentelemetry.io/collector/pdata v1.0.0-rcv0016.0.20231017160804-ec0725874313 - go.uber.org/multierr v1.11.0 gopkg.in/natefinch/lumberjack.v2 v2.2.1 ) @@ -39,6 +38,7 @@ require ( go.opentelemetry.io/otel v1.19.0 // indirect go.opentelemetry.io/otel/metric v1.19.0 // indirect go.opentelemetry.io/otel/trace v1.19.0 // indirect + go.uber.org/multierr v1.11.0 // indirect go.uber.org/zap v1.26.0 // indirect golang.org/x/net v0.17.0 // indirect golang.org/x/sys v0.13.0 // indirect