Standard library / io

io.ByteWriter

Writes one byte and reports an error, useful for byte-oriented output. Expected stdout: 'A <nil>\n'.

Formal Syntax & Structure

go syntaxgo
type ByteWriter interface {  WriteByte(c byte) error}

Working Example

Example Snippetgo
package main
import (  "bytes"  "fmt"  "io")
func main() {  var b bytes.Buffer  var w io.ByteWriter = &b  e := w.WriteByte('A')  fmt.Println(b.String(), e)}
Go Reference