Document that json.Unmarshal supports map keys whose underlying
types implement encoding.TextUnmarshaler.
Updates #38801.
Fixes #38904.
Change-Id: Icb9414e9067517531ba0da910bd4a2bb3daace65
Reviewed-on: https://go-review.googlesource.com/c/go/+/237857
Reviewed-by: Daniel Martà <mvdan@mvdan.cc>
Run-TryBot: Daniel Martà <mvdan@mvdan.cc>
TryBot-Result: Gobot Gobot <gobot@golang.org>
(cherry picked from commit
47b450997778163dfed6f58cae379d928fc37687)
Reviewed-on: https://go-review.googlesource.com/c/go/+/252617
Run-TryBot: Dmitri Shuralyov <dmitshur@golang.org>
Reviewed-by: Carlos Amedee <carlos@golang.org>
If a program needs to accept invalid numbers like the empty string,
consider wrapping the type with <a href="/pkg/encoding/json/#Unmarshaler"><code>Unmarshaler</code></a>.
</p>
+
+ <p><!-- CL 200237 -->
+ <a href="/pkg/encoding/json/#Unmarshal"><code>Unmarshal</code></a>
+ can now support map keys with string underlying type which implement
+ <a href="/pkg/encoding/#TextUnmarshaler"><code>encoding.TextUnmarshaler</code></a>.
+ </p>
</dd>
</dl><!-- encoding/json -->