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

pkg/net: replace net with net/netip #2706

Closed

Conversation

martingreber
Copy link
Contributor

@martingreber martingreber commented Nov 23, 2023

This replaces the go net package with net/netip as the latter is a better alternative and supports IPv6 checks.

Updates #2614

Copy link
Member

@mvdan mvdan left a comment

Choose a reason for hiding this comment

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

Thanks for the PR! Overall looks good.

I think it's fine to update the tests to expect the new error strings. We exposed the net errors as-is from Go, so if we switch to net/netip, we should continue to do that for the new package. If we wanted the errors to be particular to CUE, or stable over time, we would have to filter or replace all error values, but we don't really do or need to.

@martingreber
Copy link
Contributor Author

Cheers @mvdan. I've updated the tests and amended the commit to rely on the net/netip errors.

Copy link
Member

@mvdan mvdan left a comment

Choose a reason for hiding this comment

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

SGTM with some thoughts about the ParsePrefix error handling.

pkg/net/ip.go Show resolved Hide resolved
pkg/net/ip.go Outdated Show resolved Hide resolved
pkg/net/ip.go Outdated Show resolved Hide resolved
This replaces the go net package with net/netip as the
latter is a better alternative and supports IPv6 checks.

Updates cue-lang#2614

Signed-off-by: Martin Greber <[email protected]>
@martingreber
Copy link
Contributor Author

BTW, I'll get a PR ready for the Cue IPv6 check ready once this is merged. Figured that should be in a separate PR

@mvdan
Copy link
Member

mvdan commented Dec 17, 2023

Thank you! I'll be importing this PR to Gerrit now for merging, since GitHub is simply a git mirror for Gerrit. If you want to send further changes, I'd suggest sending them straight to Gerrit, for the sake of avoiding this extra step and speeding up the process :) https://github.com/cue-lang/cue/blob/master/CONTRIBUTING.md#preparing-for-gerrithub-cl-contributions

And yes, definitely agreed that we can add the new API as a separate contribution.

@mvdan
Copy link
Member

mvdan commented Dec 17, 2023

Imported as https://review.gerrithub.io/c/cue-lang/cue/+/1173735. I also added a brief note to the commit message clarifying what changes the user might see from this switch.

@cueckoo cueckoo closed this in 87a3b17 Dec 18, 2023
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.

2 participants