mirror of
https://github.com/moby/moby.git
synced 2026-08-08 09:01:44 +00:00
Merge pull request #49255 from thaJeztah/27.x_backport_ioutils_more_deprecations
[27.x backport] pkg/ioutils: deprecate NopWriter, NopWriteClose
This commit is contained in:
@@ -87,9 +87,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 []string
|
||||
|
||||
@@ -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}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user