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

Fix SortIPAddrsByNetworkSize #50

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

Conversation

thevilledev
Copy link

SortIPAddrsByNetworkSize() fails to properly sort hosts where the definitive criteria is the host having a port. For example:

128.95.120.2/32
128.95.120.2:8600

Should be:

128.95.120.2:8600
128.95.120.2/32

Caused by a logic error and fixed in this PR.

Funny though, this exact test case is part of the tests. The Sort() algorithm was changed to pdqsort in golang/go@72e77a7 and was originally released in Go 1.19. Tests pass in Go 1.18 but fail in Go 1.19. Just so it happens, the order of operations in previous Sort() implementation happens to mask this bug with the given test array.

Fixes #45.

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.

Fail test for go1.19
2 participants