Standard library / bytes
bytes.Buffer.Reset()
Discards unread bytes but retains allocated storage for reuse. Not a secure memory erase. Expected stdout: '0 true\n'.
Formal Syntax & Structure
go syntaxgo
func (b *Buffer) Reset()Working Example
Example Snippetgo
package main
import ( "bytes" "fmt")
func main() { b := bytes.NewBufferString("go") b.Reset() fmt.Println(b.Len(), b.Cap() >= 2)}