Thank you!!
io.ReadFull is just what I needed (and what I actually expected from
Reader.Read).
Why would I ever use Reader.Read rather than ReadFull?

On Tue, Jun 9, 2020 at 6:11 PM Brian Candler <b.cand...@pobox.com> wrote:

> There is io.ReadFull <https://golang.org/pkg/io/#ReadFull> if you want to
> read as much as it can into the preallocated buffer; you'll get
> io.ErrUnexpectedEOF if it's less than this.
> https://play.golang.org/p/gIAX046vNvW
>
> There is ioutil.ReadAll <https://golang.org/pkg/io/ioutil/#ReadAll> if
> you want to allocate memory to read the entire stream into a single buffer
> (assuming you have enough RAM)
> https://play.golang.org/p/Pg17S6A74SN
>
> --
> You received this message because you are subscribed to a topic in the
> Google Groups "golang-nuts" group.
> To unsubscribe from this topic, visit
> https://groups.google.com/d/topic/golang-nuts/u-wNH3NyMHo/unsubscribe.
> To unsubscribe from this group and all its topics, send an email to
> golang-nuts+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/golang-nuts/8ff054df-218c-4d52-8984-83b1c4444ed9o%40googlegroups.com
> <https://groups.google.com/d/msgid/golang-nuts/8ff054df-218c-4d52-8984-83b1c4444ed9o%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
>

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/golang-nuts/CAPTkDQVudE24DF6tWBO6yFTyF4TgZOopEfjnqZXLhVphp8SBwQ%40mail.gmail.com.

Reply via email to