On Wed, Jul 1, 2020 at 9:30 AM Glen Mailer <glenja...@gmail.com> wrote: > > We got bitten by a bug recently when using PipeWriter.CloseWithError. We > incorrectly assumed it would pass-through the error it was passed. > > The docs do say that it will always return `nil`, but does anyone know why it > has an `error` return type at all? > > I can't see an interface that it has to match, and couldn't think of any > other reason.
I think it's an unfortunate accident due to how the API was developed. When CloseWithError was first introduced (https://go.googlesource.com/go/+/6defc25c8383ab326e8c11af0c78de8a394dca84, before the open source release) it could return an error. The API has shifted a lot since then, and now it always returns a nil error. We could have cleaned it up for Go 1, but nobody noticed. Ian -- 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/CAOyqgcWeQAMc%3D6da5GX%2BfUuXEX-%3Dc3FCyb4FesycRjfLOHNTcg%40mail.gmail.com.