E546 pkg/ioutils: remove or internalize deprecated types and functions by thaJeztah · Pull Request #49245 · moby/moby · GitHub
[go: up one dir, main page]

Skip to content

Conversation

thaJeztah
Copy link
Member
@thaJeztah thaJeztah commented Jan 9, 2025

pkg/ioutils: move BytesPipe to container/streams/bytespipe

These types are only used internally in container/streams and have no
external consumers. move them to a subpackage of container/streams.

pkg/ioutils: remove deprecated WriteCounter, NewWriteCounter

pkg/ioutils: remove deprecated NopFlusher

pkg/ioutils: remove errWriteFlusherClosed

It's an alias for io.EOF and not exported, so we don't need it.

- Description for the changelog

Go SDK: pkg/ioutils: remove deprecated `BytesPipe`, `NewBytesPipe`, `ErrClosed`.
Go SDK: pkg/ioutils: remove deprecated `WriteCounter`, `NewWriteCounter`.
Go SDK: pkg/ioutils: remove deprecated `NewReaderErrWrapper`.
Go SDK: pkg/ioutils: remove deprecated `NopFlusher`.

- A picture of a cute animal (not mandatory but encouraged)

@thaJeztah thaJeztah added this to the 28.0.0 milestone Jan 9, 2025
@thaJeztah thaJeztah self-assigned this Jan 9, 2025
@thaJeztah thaJeztah changed the title pkg/ioutils: remove or internalise deprecated types and functions pkg/ioutils: remove or internalize deprecated types and functions Jan 9, 2025
These types are only used internally in container/streams and have no
external consumers. move them to a subpackage of container/streams.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
It's an alias for io.EOF and not exported, so we don't need it.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
@thaJeztah thaJeztah marked this pull request as ready for review January 10, 2025 09:20
@thaJeztah thaJeztah requested a review from vvoland January 10, 2025 09:47
@thaJeztah
Copy link
Member Author

FWIW; two more things we can get rid of, and I'll do so in a follow-up;

NopWriter; it's not used, but I left it as it felt like "potentially useful", but then considered; io.Discard would provide exactly the same, so we can remove it. It has no external users, and is not used by us;

// NopWriter represents a type which write operation is nop.
type NopWriter struct{}
func (*NopWriter) Write(buf []byte) (int, error) {
return len(buf), nil
}

NopwriteCloser; it's only used in container/streams, and has no external users. It's 5 lines of code, so we can (deprecate, and) remove it;

type nopWriteCloser struct {
io.Writer
}
func (w *nopWriteCloser) Close() error { return nil }
// NopWriteCloser returns a nopWriteCloser.
func NopWriteCloser(w io.Writer) io.WriteCloser {
return &nopWriteCloser{w}
}

// 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)
}

@thaJeztah thaJeztah merged commit 71253c3 into moby:master Jan 10, 2025
143 checks passed
@thaJeztah thaJeztah deleted the ioutils_cleaner branch January 10, 2025 13:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Development

Successfully merging this pull request may close these issues.

2 participants
0