go/types: guarantee sorting of named type methods #61298
Labels
NeedsDecision
Feedback is required from experts, contributors, and/or the community before a change can be made.
Milestone
Certain libraries such as
x/tools/go/types/objectpath
rely on a well-defined sorting of methods onNamed
types. To enforce this definition, theobjectpath
package sorts, but as seen in #58668 (comment) that can be quite expensive.We can fix that particular issue outside of go/types, but it would be nice to commit to a fixed ordering of methods in the go/types API. IIRC the ordering is currently deterministic and in source order (as defined by the input file slice), but this is not documented. We should document and preserve this behavior, or pick a different stable sort.
CC @griesemer @adonovan
The text was updated successfully, but these errors were encountered: