diff options
author | Rob Pike <r@golang.org> | 2018-05-31 06:51:08 +1000 |
---|---|---|
committer | Rob Pike <r@golang.org> | 2018-05-30 21:48:28 +0000 |
commit | fcbcd37d6473d287176aecd8a341f1c69d0f19b6 (patch) | |
tree | 2b1fb452aad10ef39b4cbdf8b0a310586a22f5d6 /content/go-maps-in-action.article | |
parent | 6e856e3a1c279fb176399d723838b222a8de7aec (diff) |
blog/content/go-maps-in-action: clean up ambiguous final paragraph
Rewrite final paragraph for clarity. The grammar was ambiguous
and confusing.
Break up the huge paragraph into multiple lines. I left the rest of the document untouched to localize the changes.
Fixes golang/go#25647.
Change-Id: I8f3b54c3429e60658437731c357e7e7feb8937f3
Reviewed-on: https://go-review.googlesource.com/115395
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Diffstat (limited to 'content/go-maps-in-action.article')
-rw-r--r-- | content/go-maps-in-action.article | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/content/go-maps-in-action.article b/content/go-maps-in-action.article index e57edc6..7cca838 100644 --- a/content/go-maps-in-action.article +++ b/content/go-maps-in-action.article @@ -170,7 +170,11 @@ To write to the counter, take the write lock: * Iteration order -When iterating over a map with a range loop, the iteration order is not specified and is not guaranteed to be the same from one iteration to the next. Since Go 1 the runtime randomizes map iteration order, as programmers relied on the stable iteration order of the previous implementation. If you require a stable iteration order you must maintain a separate data structure that specifies that order. This example uses a separate sorted slice of keys to print a `map[int]string` in key order: +When iterating over a map with a range loop, the iteration order is not specified and is not guaranteed to be the same from one iteration to the next. +Since the release of Go 1.0, the runtime has randomized map iteration order. +Programmers had begun to rely on the stable iteration order of early versions of Go, which varied between implementations, leading to portability bugs. +If you require a stable iteration order you must maintain a separate data structure that specifies that order. +This example uses a separate sorted slice of keys to print a `map[int]string` in key order: import "sort" |