zekro' Dev Blog

zekro' Dev Blog

Opinions, tutorials and guids about development and tech.

Hard-Capping a bytes.Buffer.
Golang

Hard-Capping a bytes.Buffer.

Go has a handy dandy struct called bytes.Buffer [https://golang.org/pkg/bytes/#Buffer] which consumes a byte slice and implements the interfaces io.Writer [https://golang.org/pkg/io/#Writer] and io.Reader [https://golang.org/pkg/io/#Reader]. So, it's simply a slice of memory
3 min read