Skip to content

Commit 627de0d

Browse files
[chore] refactor a struct used in testing to unexport it (#40229)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
1 parent c2572fb commit 627de0d

File tree

2 files changed

+8
-8
lines changed

2 files changed

+8
-8
lines changed

exporter/fileexporter/buffered_writer_test.go

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -24,18 +24,18 @@ const (
2424
SizeMegaByte
2525
)
2626

27-
type NopWriteCloser struct {
27+
type nopWriteCloser struct {
2828
w io.Writer
2929
}
3030

31-
func (NopWriteCloser) Close() error { return nil }
32-
func (wc *NopWriteCloser) Write(p []byte) (int, error) { return wc.w.Write(p) }
31+
func (nopWriteCloser) Close() error { return nil }
32+
func (wc *nopWriteCloser) Write(p []byte) (int, error) { return wc.w.Write(p) }
3333

3434
func TestBufferedWrites(t *testing.T) {
3535
t.Parallel()
3636

3737
b := bytes.NewBuffer(nil)
38-
w := newBufferedWriteCloser(&NopWriteCloser{b})
38+
w := newBufferedWriteCloser(&nopWriteCloser{b})
3939

4040
_, err := w.Write([]byte(msg))
4141
require.NoError(t, err, "Must not error when writing data")
@@ -67,8 +67,8 @@ func BenchmarkWriter(b *testing.B) {
6767
payload[i] = 'a'
6868
}
6969
for name, w := range map[string]io.WriteCloser{
70-
"discard": &NopWriteCloser{io.Discard},
71-
"buffered-discard": newBufferedWriteCloser(&NopWriteCloser{io.Discard}),
70+
"discard": &nopWriteCloser{io.Discard},
71+
"buffered-discard": newBufferedWriteCloser(&nopWriteCloser{io.Discard}),
7272
"raw-file": tempfile(b),
7373
"buffered-file": newBufferedWriteCloser(tempfile(b)),
7474
} {

exporter/fileexporter/file_exporter_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -778,7 +778,7 @@ func TestFlushing(t *testing.T) {
778778

779779
// Create a buffer to capture the output.
780780
bbuf := &tsBuffer{b: &bytes.Buffer{}}
781-
buf := &NopWriteCloser{bbuf}
781+
buf := &nopWriteCloser{bbuf}
782782
// Wrap the buffer with the buffered writer closer that implements flush() method.
783783
bwc := newBufferedWriteCloser(buf)
784784
// Create a file exporter with flushing enabled.
@@ -833,7 +833,7 @@ func TestAppend(t *testing.T) {
833833

834834
// Create a buffer to capture the output.
835835
bbuf := &tsBuffer{b: &bytes.Buffer{}}
836-
buf := &NopWriteCloser{bbuf}
836+
buf := &nopWriteCloser{bbuf}
837837
// Wrap the buffer with the buffered writer closer that implements flush() method.
838838
bwc := newBufferedWriteCloser(buf)
839839
// Create a file exporter with flushing enabled.

0 commit comments

Comments
 (0)