Standard library / bytes
bytes.Buffer.UnreadByte()
Undoes one byte from the last successful read operation; fails if no valid previous read. Expected stdout: '<nil> go\n'.
Formal Syntax & Structure
go syntaxgo
func (b *Buffer) UnreadByte() errorReturn Value
error
Undoes one byte from the last successful read operation; fails if no valid previous read.
Working Example
Example Snippetgo
package main
import ( "bytes" "fmt")
func main() { b := bytes.NewBufferString("go") b.ReadByte() e := b.UnreadByte() fmt.Println(e, b.String())}