• BlueKey@fedia.ioOP
    link
    fedilink
    arrow-up
    1
    ·
    3 months ago

    I’m new to Go and wanted to copy some text-data from a stream into the outputstream of the HTTP response. I was copying the data to and from a []byte with a single Read() and Write() call and expexted everything to be copied as the buffer is always the size of the while data. Turns out Read() sometimes fills the whole buffer and sometimes don’t.
    Now I’m using io.Copy().