Standard library / net
net.Buffers
A list of byte slices implementing io.Reader and io.WriterTo through a pointer. Reads and writes consume the slice headers, not the underlying bytes; copy headers to reuse them. Expected stdout: 'abcd 0\n'.
Formal Syntax & Structure
go syntaxgo
type Buffers [][]byteWorking Example
Example Snippetgo
package main
import ( "bytes" "fmt" "net")
func main() { v := net.Buffers{[]byte("ab"), []byte("cd")} var b bytes.Buffer must(v.WriteTo(&b)) fmt.Println(b.String(), len(v))}
func must[T any](v T, e error) T { if e != nil { panic(e) } return v}func check(e error) { if e != nil { panic(e) }}