File tree Expand file tree Collapse file tree 1 file changed +4
-8
lines changed Expand file tree Collapse file tree 1 file changed +4
-8
lines changed Original file line number Diff line number Diff line change @@ -22,7 +22,7 @@ import (
2222 "go/token"
2323 "log"
2424 "os"
25- "sort "
25+ "slices "
2626 "strings"
2727 "text/template"
2828)
@@ -182,7 +182,9 @@ func (t *templateData) dump() error {
182182 }
183183
184184 // Sort getters by ReceiverType.FieldName.
185- sort .Sort (byName (t .Getters ))
185+ slices .SortStableFunc (t .Getters , func (a , b * getter ) int {
186+ return strings .Compare (a .sortVal , b .sortVal )
187+ })
186188
187189 processTemplate := func (tmpl * template.Template , filename string ) error {
188190 var buf bytes.Buffer
@@ -344,12 +346,6 @@ type getter struct {
344346 ArrayType bool
345347}
346348
347- type byName []* getter
348-
349- func (b byName ) Len () int { return len (b ) }
350- func (b byName ) Less (i , j int ) bool { return b [i ].sortVal < b [j ].sortVal }
351- func (b byName ) Swap (i , j int ) { b [i ], b [j ] = b [j ], b [i ] }
352-
353349const source = `// Copyright {{.Year}} The go-github AUTHORS. All rights reserved.
354350//
355351// Use of this source code is governed by a BSD-style
You can’t perform that action at this time.
0 commit comments