diff --git a/container/stream/streams.go b/container/stream/streams.go index 371006b64e..aa9b57a4a5 100644 --- a/container/stream/streams.go +++ b/container/stream/streams.go @@ -10,7 +10,6 @@ import ( "github.com/containerd/containerd/cio" "github.com/containerd/log" "github.com/docker/docker/container/stream/bytespipe" - "github.com/docker/docker/pkg/ioutils" "github.com/docker/docker/pkg/pools" ) @@ -86,9 +85,15 @@ func (c *Config) NewInputPipes() { // NewNopInputPipe creates a new input pipe that will silently drop all messages in the input. func (c *Config) NewNopInputPipe() { - c.stdinPipe = ioutils.NopWriteCloser(io.Discard) + c.stdinPipe = &nopWriteCloser{io.Discard} } +type nopWriteCloser struct { + io.Writer +} + +func (w *nopWriteCloser) Close() error { return nil } + // CloseStreams ensures that the configured streams are properly closed. func (c *Config) CloseStreams() error { var errs error diff --git a/pkg/ioutils/writers.go b/pkg/ioutils/writers.go index bed7c8807e..b896f16ebc 100644 --- a/pkg/ioutils/writers.go +++ b/pkg/ioutils/writers.go @@ -6,6 +6,8 @@ import ( ) // NopWriter represents a type which write operation is nop. +// +// Deprecated: use [io.Discard] instead. This type will be removed in the next release. type NopWriter struct{} func (*NopWriter) Write(buf []byte) (int, error) { @@ -19,6 +21,8 @@ type nopWriteCloser struct { func (w *nopWriteCloser) Close() error { return nil } // NopWriteCloser returns a nopWriteCloser. +// +// Deprecated: This function is no longer used and will be removed in the next release. func NopWriteCloser(w io.Writer) io.WriteCloser { return &nopWriteCloser{w} }