#bytes.NewBuffer that doesn't take ownership
10 messages · Page 1 of 1 (latest)
What are you trying to do exactly?
I've got a []byte slice that I need to pass somewhere, but I also have some methods that take in an io.Reader
So you want to implement a reader on a byte slice but you don't want to copy it?
You can literally make a new type and implement reader yourself
Its like 20 lines
bytes.NewReader is what you want
a valid implementation is 20 lines, it's more like 70 when you include optimizations.
Just use bytes.NewReader 
oh god how did I miss that
thank you
func NewReader(b []byte) *Reader
```
NewReader returns a new Reader reading from b.