internal/trace/v2: make readBatch param more permissive

This function is copied to x/exp/trace. In https://go.dev/cl/566255 a
change is made where the source is a bytes.Reader instead of a
bufio.Reader from one of the two callers. Change the prototype here
instead of diverging the implementations.

Change-Id: I594224663996eadbc8c388442d68ac5706c52c8e
Reviewed-on: https://go-review.googlesource.com/c/go/+/566236
Auto-Submit: Michael Knyszek <mknyszek@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
This commit is contained in:
Nicolas Hillegeer 2024-02-22 13:50:47 -08:00 committed by Gopher Robot
parent db57e5a040
commit d892cb496a
1 changed files with 4 additions and 2 deletions

View File

@ -5,7 +5,6 @@
package trace
import (
"bufio"
"bytes"
"encoding/binary"
"fmt"
@ -43,7 +42,10 @@ func (b *batch) isFreqBatch() bool {
}
// readBatch reads the next full batch from r.
func readBatch(r *bufio.Reader) (batch, uint64, error) {
func readBatch(r interface {
io.Reader
io.ByteReader
}) (batch, uint64, error) {
// Read batch header byte.
b, err := r.ReadByte()
if err != nil {