Skip to content

Commit 46b0e0c

Browse files
committed
stylecheck: sort receiver names for reproducible output
1 parent 20c72ce commit 46b0e0c

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

stylecheck/lint.go

+2
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import (
66
"go/constant"
77
"go/token"
88
"go/types"
9+
"sort"
910
"strconv"
1011
"strings"
1112
"unicode"
@@ -304,6 +305,7 @@ func CheckReceiverNamesIdentical(pass *analysis.Pass) (interface{}, error) {
304305
for name, count := range names {
305306
seen = append(seen, fmt.Sprintf("%dx %q", count, name))
306307
}
308+
sort.Strings(seen)
307309

308310
pass.Reportf(firstFn.Pos(), "methods on the same type should have the same receiver name (seen %s)", strings.Join(seen, ", "))
309311
}

0 commit comments

Comments
 (0)