Commit 4b3019b1 authored by Keith Randall's avatar Keith Randall

doc: mention that reflect.SetMapIndex no longer panics

when deleting from a nil map.  See issue 8051.

LGTM=r
R=golang-codereviews, r, khr
CC=golang-codereviews
https://golang.org/cl/96540051
parent 05cc78d8
...@@ -509,6 +509,12 @@ In particular, it only calls <a href="/pkg/os/exec/#LookPath"><code>LookPath</co ...@@ -509,6 +509,12 @@ In particular, it only calls <a href="/pkg/os/exec/#LookPath"><code>LookPath</co
when the binary's file name contains no path separators. when the binary's file name contains no path separators.
</li> </li>
<li>
The <a href="/pkg/reflect/#Value.SetMapIndex"><code>SetMapIndex</code></a>
function in the <a href="/pkg/reflect/"><code>reflect</code></a> package
no longer panics when deleting from a <code>nil</code> map.
</li>
<li> <li>
If the main goroutine calls If the main goroutine calls
<a href="/pkg/runtime/#Goexit"><code>runtime.Goexit</code></a> <a href="/pkg/runtime/#Goexit"><code>runtime.Goexit</code></a>
......
...@@ -1620,6 +1620,7 @@ func (v Value) SetCap(n int) { ...@@ -1620,6 +1620,7 @@ func (v Value) SetCap(n int) {
// SetMapIndex sets the value associated with key in the map v to val. // SetMapIndex sets the value associated with key in the map v to val.
// It panics if v's Kind is not Map. // It panics if v's Kind is not Map.
// If val is the zero Value, SetMapIndex deletes the key from the map. // If val is the zero Value, SetMapIndex deletes the key from the map.
// Otherwise if v holds a nil map, SetMapIndex will panic.
// As in Go, key's value must be assignable to the map's key type, // As in Go, key's value must be assignable to the map's key type,
// and val's value must be assignable to the map's value type. // and val's value must be assignable to the map's value type.
func (v Value) SetMapIndex(key, val Value) { func (v Value) SetMapIndex(key, val Value) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment