containerd / fifo

fifo pkg for Go
https://containerd.io
Apache License 2.0
87 stars 30 forks source link

Return nil when openFifo returns nil #47

Closed corhere closed 1 year ago

corhere commented 2 years ago

The return statement in the OpenFifo wrapper function implicitly boxes the *fifo pointer into an io.ReadWriteCloser interface value, even when the value is (*fifo)(nil). It is the same gotcha described in https://go.dev/doc/faq#nil_error and causes the same sorts of confusing situations. Modify the OpenFifo wrapper function to return a nil interface value when openFifo returns a nil pointer value.

corhere commented 2 years ago

@cpuguy83 @thaJeztah @AkihiroSuda @dmcgowan PTAL

thaJeztah commented 2 years ago

Oh! Saw the PR title and had to think of https://github.com/containerd/fifo/pull/32, but I see you linked that above, nice 👍