Skip to content

Commit 458e9af

Browse files
sugaf1204Copilot
andauthored
Update apis/fluentd/v1alpha1/plugins/params/model.go
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> Signed-off-by: sugaf1204 <139354727+sugaf1204@users.noreply.github.com>
1 parent 0d256ce commit 458e9af

File tree

1 file changed

+3
-5
lines changed
  • apis/fluentd/v1alpha1/plugins/params

1 file changed

+3
-5
lines changed

apis/fluentd/v1alpha1/plugins/params/model.go

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -263,14 +263,12 @@ func (a PluginStoreByNameById) Less(i, j int) bool {
263263
// lessId orders @id strings so that numeric suffixes compare numerically once
264264
// both ids share a "<prefix>-<index>" shape. A plain lexicographic compare
265265
// would place "<p>-10" before "<p>-2" because '1' < '2'. Falls back to
266-
// lexicographic order when either side lacks a numeric trailing segment.
266+
// lexicographic order when either side lacks a numeric trailing segment or
267+
// when the parsed prefixes differ.
267268
func lessId(id1, id2 string) bool {
268269
p1, n1, ok1 := splitIdIndex(id1)
269270
p2, n2, ok2 := splitIdIndex(id2)
270-
if ok1 && ok2 {
271-
if p1 != p2 {
272-
return p1 < p2
273-
}
271+
if ok1 && ok2 && p1 == p2 {
274272
return n1 < n2
275273
}
276274
return id1 < id2

0 commit comments

Comments
 (0)