Skip to content

Commit

Permalink
[chore][exporter/fileexporter] use errors.Join instead of go.uber.org…
Browse files Browse the repository at this point in the history
…/multierr (#27835)

**Description:** fileexporter: use errors.Join instead of go.uber.org/multierr

**Link to tracking Issue:** #25121
  • Loading branch information
bagmeg authored Oct 19, 2023
1 parent c482aa7 commit be81ae7
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 6 deletions.
5 changes: 2 additions & 3 deletions exporter/fileexporter/buffered_writer.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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(),
)
Expand Down
4 changes: 2 additions & 2 deletions exporter/fileexporter/buffered_writer_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ package fileexporter

import (
"bytes"
"errors"
"fmt"
"io"
"os"
Expand All @@ -13,7 +14,6 @@ import (

"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
"go.uber.org/multierr"
)

const (
Expand Down Expand Up @@ -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())
})
}
}
Expand Down
2 changes: 1 addition & 1 deletion exporter/fileexporter/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -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
)

Expand All @@ -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
Expand Down

0 comments on commit be81ae7

Please sign in to comment.