]> Cypherpunks repositories - gostls13.git/commit
net: replace sort with slices for address and DNS record sorting
authoraimuz <mr.imuz@gmail.com>
Tue, 28 May 2024 13:53:53 +0000 (13:53 +0000)
committerGopher Robot <gobot@golang.org>
Wed, 31 Jul 2024 22:06:36 +0000 (22:06 +0000)
commit38c427c9dc729597df5e735a7db9549feea0ebc1
treeaa4752749f533b8529611d90dd13d9d443b1b766
parent1b6bb779ef92de489a51b177035362795636624b
net: replace sort with slices for address and DNS record sorting

This change replaces the usage of the "sort" package with the "slices"
package for sorting IP addresses and DNS records. The new approach
simplifies the code and improves readability by leveraging the
slices.SortFunc and slices.SortStableFunc functions.

- Updated addrselect.go to use slices.SortStableFunc for sorting IP
  addresses based on RFC 6724.
- Refactored dnsclient.go to use slices.SortFunc for sorting SRV and MX
  records by priority and weight.

This change also reduces the dependency tree for the package by
removing the dependency on "sort" and its transitive dependencies,
resulting in a leaner build.

Change-Id: I436dacc8dd1e8f2f7eeac44d6719ce248394d8a9
GitHub-Last-Rev: 3720a490815e2dc2fad06b107f21c67f5ad6c6c8
GitHub-Pull-Request: golang/go#67503
Reviewed-on: https://go-review.googlesource.com/c/go/+/586635
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Reviewed-by: Damien Neil <dneil@google.com>
Auto-Submit: Ian Lance Taylor <iant@google.com>
src/net/addrselect.go