I am trying to use net.Buffers as follows, to read a string into it:
package main
import (
"fmt"
"net"
)
func main() {
msg := "Hello"
var bufs net.Buffers
n, err := bufs.Read([]byte(msg))
if err != nil {
fmt.Println("bufs.Read error:", err)
return
}
fmt.Printf("Read %d bytes", n)
}
However, when run bufs.Read(...) fails with:
bufs.Read error: EOF
Contrary to what I thought bufs.Read(...) is NOT reading the input argument of this API into itself.
So, how can I fill bufs with some data, that can be written to something like a net.Conn ?