Skip to content

Map key sorting could be improved #1

Description

@emidoots

Map keys are sorted according to regular Go rules, but a number of Go values cannot be sorted according to those rules. As it stands, valast will produce unstable output in such situations.

It would be nice to find a better way to resolve this. Feedback on how to handle this very welcome.

  • Panic or error when such a map key is encountered, ask the user provide a comparison function
  • See if go-cmp does anything for this - I suspect they don't have to because they can just compare map keys for equality
  • Take into consideration the drawbacks and benefits with the go-spew approach, output not being sorted by default, sorting by spewed keys is interesting but may have edge cases that are not handled, etc.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or requesthelp wantedExtra attention is needed

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions