diff --git a/reflect_abi_code.go b/reflect_abi_code.go index 53f467cb..ad944737 100644 --- a/reflect_abi_code.go +++ b/reflect_abi_code.go @@ -22,7 +22,7 @@ package main // Injected code below this line. // Each pair is the obfuscated and then the real name. -// The slice is sorted from shortest to longest obfuscated name. +// The pairs are sorted by obfuscated name, lexicographically. var _originalNamePairs = []string{} var _originalNamesReplacer *_genericReplacer diff --git a/reflect_abi_patch.go b/reflect_abi_patch.go index 30392e74..7915d235 100644 --- a/reflect_abi_patch.go +++ b/reflect_abi_patch.go @@ -2,7 +2,6 @@ package main import ( "bytes" - "cmp" _ "embed" "fmt" "maps" @@ -67,12 +66,7 @@ func reflectMainPostPatch(file []byte, lpkg *listedPackage, pkg pkgCache) []byte obfVarName := hashWithPackage(lpkg, "_originalNamePairs") namePairs := fmt.Appendf(nil, "%s = []string{", obfVarName) - keys := slices.SortedFunc(maps.Keys(pkg.ReflectObjectNames), func(a, b string) int { - if c := cmp.Compare(len(a), len(b)); c != 0 { - return c - } - return cmp.Compare(a, b) - }) + keys := slices.Sorted(maps.Keys(pkg.ReflectObjectNames)) namePairsFilled := bytes.Clone(namePairs) for _, obf := range keys { namePairsFilled = fmt.Appendf(namePairsFilled, "%q, %q,", obf, pkg.ReflectObjectNames[obf])