Use Write and WriteString to add data, and Read, ReadString, or Bytes to retrieve it from a bytes.Buffer.
import "bytes"
var buf bytes.Buffer
// Write data
buf.WriteString("Hello, ")
buf.Write([]byte("World!"))
// Read data
content := buf.String() // Get full content as string
// or
data := buf.Bytes() // Get full content as []byte
// or
buf.Reset() // Clear buffer for reuse