fmt: maps with NaN keys are not printed correctly #14427
Labels
FrozenDueToAge
NeedsDecision
Feedback is required from experts, contributors, and/or the community before a change can be made.
Milestone
go version go1.6 linux/amd64
prints
map[0.1:5 NaN:<nil> NaN:<nil>]
.I would have hoped for
map[0.1:5 NaN:3 NaN:4]
since for example iterating over the map with afor
loop can retrieve the values 3 and 4. Perhaps acceptable would bemap[0.1:5 NaN:0 NaN:0]
, consistent withv, ok := m[math.NaN()]
returning 0, false. But printing when nil is not a valid value for the int type is unexpected.The text was updated successfully, but these errors were encountered: