Skip to content

text/template: {{range}} docs mention sorting "comparable" map keys, should say "ordered" instead #34147

@ghost

Description

What did you do?

Read package docs for {{range pipeline}}:
https://golang.org/pkg/text/template/#hdr-Actions

What did you expect to see?

Map keys of an ordered type are visited in sorted key order.

What did you see instead?

Map keys of a comparable type are visited in sorted key order:

If the value is a map and the keys are of basic type with a defined order ("comparable"), the elements will be visited in sorted key order.

The spec defines comparable and ordered types as:
https://golang.org/ref/spec#Comparison_operators

The equality operators == and != apply to operands that are comparable. The ordering operators <, <=, >, and >= apply to operands that are ordered.

Metadata

Metadata

Assignees

No one assigned

    Labels

    DocumentationIssues describing a change to documentation.FrozenDueToAgeNeedsFixThe path to resolution is known, but the work has not been done.help wanted

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions