Skip to content

Commit

Permalink
pkg/netutil: avoid type conversion between uint8 and int for GetDefau…
Browse files Browse the repository at this point in the history
…ltHost

Signed-off-by: Jes Cok <xigua67damn@gmail.com>
  • Loading branch information
callthingsoff committed Apr 29, 2024
1 parent 6a1e28a commit 1257ab7
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions pkg/netutil/routes_linux.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,14 +48,13 @@ func GetDefaultHost() (string, error) {
}

// sort so choice is deterministic
var families []int
var families []uint8
for family := range rmsgs {
families = append(families, int(family))
families = append(families, family)
}
sort.Ints(families)
slices.Sort(families)

Check failure on line 55 in pkg/netutil/routes_linux.go

View workflow job for this annotation

GitHub Actions / test

undefined: slices

for _, f := range families {
family := uint8(f)
for _, family := range families {
if host, err := chooseHost(family, rmsgs[family]); host != "" || err != nil {
return host, err
}
Expand Down

0 comments on commit 1257ab7

Please sign in to comment.