From: Nicolas Hillegeer Date: Thu, 22 Feb 2024 21:50:47 +0000 (-0800) Subject: internal/trace/v2: make readBatch param more permissive X-Git-Tag: go1.23rc1~1153 X-Git-Url: http://www.git.cypherpunks.su/?a=commitdiff_plain;h=d892cb496a30ec274ee87f3cd0cf6bb7ac682ab3;p=gostls13.git 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 LUCI-TryBot-Result: Go LUCI Reviewed-by: Michael Knyszek --- diff --git a/src/internal/trace/v2/batch.go b/src/internal/trace/v2/batch.go index 899eb0f59b..d7afc06eec 100644 --- a/src/internal/trace/v2/batch.go +++ b/src/internal/trace/v2/batch.go @@ -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 {