Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cleanup: refactor and use bicopy everywhere #2944

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

tamird
Copy link
Contributor

@tamird tamird commented Nov 25, 2024

See commit message.

@tamird tamird force-pushed the remove-bicopy branch 2 times, most recently from 4ec7fa0 to 63ae319 Compare November 27, 2024 17:49
Copy link
Member

@nirs nirs left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This changes the behavior but you did not provide any reason for the change. If the purpose is to remove eliminate a package, just inline the package code in the single user. There is no need to change the code.

If you want to reimplement it and/or change the behavior, please explain why.

Also we have good tests for port_darwin? Before rewriting we should have good tests ensuring that we don't change the behavior by mistake. It should be simple test coping data over unix sockets.

pkg/hostagent/port_darwin.go Outdated Show resolved Hide resolved
pkg/hostagent/port_darwin.go Outdated Show resolved Hide resolved
pkg/hostagent/port_darwin.go Outdated Show resolved Hide resolved
pkg/hostagent/port_darwin.go Show resolved Hide resolved
@tamird tamird force-pushed the remove-bicopy branch 2 times, most recently from 6a612d9 to c8e7582 Compare November 27, 2024 21:30
pkg/vz/network_darwin.go Show resolved Hide resolved
pkg/vz/network_darwin.go Show resolved Hide resolved
@tamird tamird force-pushed the remove-bicopy branch 3 times, most recently from a2a75a4 to b92ac24 Compare November 28, 2024 13:55
@tamird tamird changed the title cleanup: remove package bicopy cleanup: refactor and use bicopy everywhere Nov 28, 2024
There are 3 instances of this pattern and each does this slightly
differently. Clean up the implementation to return errors using
`errors.Join` (which wasn't available when the original was written) and
use it everywhere.

This doesn't change behavior because the error return is always just
logged (see the only called of `(*pseudoLoopbackForwarder).forward`.

Note that the removal of the special handling of `io.EOF` returned from
`io.Copy` doesn't change behavior because it can never happen per the
latter's documentation.

Signed-off-by: Tamir Duberstein <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants