Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
ghost opened this issue Sep 6, 2019 · 1 comment
Labels
Documentation FrozenDueToAge help wanted NeedsFix The path to resolution is known, but the work has not been done.
Milestone

Comments

@ghost
Copy link

ghost commented Sep 6, 2019

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.

@ianlancetaylor ianlancetaylor added help wanted NeedsFix The path to resolution is known, but the work has not been done. labels Sep 6, 2019
@ianlancetaylor ianlancetaylor added this to the Go1.14 milestone Sep 6, 2019
@gopherbot
Copy link

Change https://golang.org/cl/193840 mentions this issue: text/template: docs: sort "ordered" (not "comparable") map keys

@golang golang locked and limited conversation to collaborators Sep 5, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Documentation FrozenDueToAge help wanted NeedsFix The path to resolution is known, but the work has not been done.
Projects
None yet
Development

No branches or pull requests

2 participants