1
0
mirror of https://github.com/golang/go synced 2024-11-05 22:36:10 -07:00
go/src/fmt
Martin Möhrmann 773e894645 fmt: print values for map keys with non-reflexive equality
Previously fmt would first obtain a list of map keys
and then look up the value for each key. Since NaNs can
be map keys but cannot be fetched directly, the lookup would
fail and return a zero reflect.Value, which formats as <nil>.

golang.org/cl/33572 added a map iterator to the reflect package
that is used in this CL to retrieve the key and value from
the map and prints the correct value even for keys that are not
equal to themselves.

Fixes #14427

Change-Id: I9e1522959760b3de8b7ecf7a6e67cd603339632a
Reviewed-on: https://go-review.googlesource.com/129777
Reviewed-by: Alan Donovan <adonovan@google.com>
2018-08-22 21:32:42 +00:00
..
doc.go strconv: clarify "g" and "G" precision in the docs 2018-08-01 00:57:00 +00:00
example_test.go fmt: add Stringer example 2017-08-16 18:02:42 +00:00
export_test.go fmt: add tests for parsenum 2016-10-04 21:00:35 +00:00
fmt_test.go fmt: print values for map keys with non-reflexive equality 2018-08-22 21:32:42 +00:00
format.go fmt: change some unexported method names to camel case 2018-02-27 20:12:04 +00:00
print.go fmt: print values for map keys with non-reflexive equality 2018-08-22 21:32:42 +00:00
scan_test.go fmt: document and adjust Scanf space handling to eliminate a few paradoxes 2016-10-07 03:46:50 +00:00
scan.go fmt: remove stopAtNewline unused parameter 2017-08-11 04:56:58 +00:00
stringer_test.go