Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 5 additions & 12 deletions core/commands/completion.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import (
"io"
"slices"
"sort"
"text/template"

Expand Down Expand Up @@ -68,18 +69,10 @@
parsed.Options = append(parsed.Options, flag)
}
}
sort.Slice(parsed.LongFlags, func(i, j int) bool {
return parsed.LongFlags[i] < parsed.LongFlags[j]
})
sort.Slice(parsed.ShortFlags, func(i, j int) bool {
return parsed.ShortFlags[i] < parsed.ShortFlags[j]
})
sort.Slice(parsed.LongOptions, func(i, j int) bool {
return parsed.LongOptions[i] < parsed.LongOptions[j]
})
sort.Slice(parsed.ShortOptions, func(i, j int) bool {
return parsed.ShortOptions[i] < parsed.ShortOptions[j]
})
slices.Sort(parsed.LongFlags)
slices.Sort(parsed.ShortFlags)
slices.Sort(parsed.LongOptions)
slices.Sort(parsed.ShortOptions)

Check warning on line 75 in core/commands/completion.go

View check run for this annotation

Codecov / codecov/patch

core/commands/completion.go#L72-L75

Added lines #L72 - L75 were not covered by tests
return parsed
}

Expand Down
5 changes: 3 additions & 2 deletions core/commands/id.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
"errors"
"fmt"
"io"
"slices"
"sort"
"strings"

Expand Down Expand Up @@ -174,7 +175,7 @@

protocols, _ := ps.GetProtocols(p) // don't care about errors here.
info.Protocols = append(info.Protocols, protocols...)
sort.Slice(info.Protocols, func(i, j int) bool { return info.Protocols[i] < info.Protocols[j] })
slices.Sort(info.Protocols)

Check warning on line 178 in core/commands/id.go

View check run for this annotation

Codecov / codecov/patch

core/commands/id.go#L178

Added line #L178 was not covered by tests

if v, err := ps.Get(p, "AgentVersion"); err == nil {
if vs, ok := v.(string); ok {
Expand Down Expand Up @@ -207,7 +208,7 @@
}
sort.Strings(info.Addresses)
info.Protocols = node.PeerHost.Mux().Protocols()
sort.Slice(info.Protocols, func(i, j int) bool { return info.Protocols[i] < info.Protocols[j] })
slices.Sort(info.Protocols)

Check warning on line 211 in core/commands/id.go

View check run for this annotation

Codecov / codecov/patch

core/commands/id.go#L211

Added line #L211 was not covered by tests
}
info.AgentVersion = version.GetUserAgentVersion()
return info, nil
Expand Down
3 changes: 2 additions & 1 deletion core/commands/swarm.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
"fmt"
"io"
"path"
"slices"
"sort"
"strconv"
"sync"
Expand Down Expand Up @@ -488,7 +489,7 @@

if protocols, err := ps.GetProtocols(p); err == nil {
info.Protocols = append(info.Protocols, protocols...)
sort.Slice(info.Protocols, func(i, j int) bool { return info.Protocols[i] < info.Protocols[j] })
slices.Sort(info.Protocols)

Check warning on line 492 in core/commands/swarm.go

View check run for this annotation

Codecov / codecov/patch

core/commands/swarm.go#L492

Added line #L492 was not covered by tests
}

if v, err := ps.Get(p, "AgentVersion"); err == nil {
Expand Down
Loading