Carlo Alberto Ferraris

Results 39 comments of Carlo Alberto Ferraris

Maybe `buf.Rewind(1)` could become `buf.RewindSuffix(",")` where RewindSuffix(s) is a function that Rewinds the buffer by `len(s)` if the buffer ends with `s`. This way we wouldn't need the extra space...

Same here. I actually already set up things in the past but the slack status updates stopped working, so I tried to perform the setup again on https://spotify-my-slack.herokuapp.com/ but I...

While I agree that this change is quite desirable, I'm also not convinced by the backward compatibility of such a change. Nowhere in the errgroup docs we say that `Wait()`...

> > Under the current proposal, AFAICT, the panic would be silently swallowed if Wait() was never called. > > This is an interesting point. I will leave this as...

We could maybe make `ReadAll` forward to `Copy` with something like this? ```golang func ReadAll(r Reader) ([]byte, error) { sw := new(sliceWriter) _, err := Copy(sw, r) return *sw, err...

@bboreham sure, it boils down to io.Copy being able to optimize the copy by forwarding to io.ReaderFrom on the destination io.Writer, or to io.WriterTo on the source io.Reader. In this...

@bboreham My benchmark is using httptest.NewServer to simulate reading the http response body from a [real socket](https://cs.opensource.google/go/go/+/refs/tags/go1.19:src/net/http/httptest/server.go;l=68-73;drc=91d5ce3def7c967b23de37546439bb4714e26e8a). You can also confirm this by inspecting the benchmark CPU profile and noticing...

Yup. And you're right, with singnficantly larger response sizes (1MB or more) the larger buffer growth of bytes.Buffer will make bytes.Buffer.ReadFrom faster. I will try in the next days to...

Not a super fan of requiring a dedicated block to scope the defer (to see why imagine you need to have N files open: it's going to quickly start drifting...

I'm fine with the label approach, but I would really prefer if there was a way to refer to the current scope without a label (as i would expect the...