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.
This appears to have been the only code path by which a (*fifo)(nil) value could escape the package, and therefore the root cause of https://github.com/docker/for-linux/issues/1186 for which #32 was added as a workaround.
The return statement in the
OpenFifo
wrapper function implicitly boxes the*fifo
pointer into anio.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 theOpenFifo
wrapper function to return anil
interface value whenopenFifo
returns anil
pointer value.(*fifo)(nil)
value could escape the package, and therefore the root cause of https://github.com/docker/for-linux/issues/1186 for which #32 was added as a workaround.