Getting “bytes.Buffer does not implement io.Writer” error message

Pass a pointer to the buffer, instead of the buffer itself:

import "bufio"
import "bytes"

func main() {
    var b bytes.Buffer
    foo := bufio.NewWriter(&b)
}

Leave a Comment