mirror of
https://github.com/golang/go.git
synced 2024-09-22 10:58:58 +00:00
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
This commit is contained in:
parent
05cc78d8d3
commit
4b3019b17c
@ -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.
|
||||
</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>
|
||||
If the main goroutine calls
|
||||
<a href="/pkg/runtime/#Goexit"><code>runtime.Goexit</code></a>
|
||||
|
@ -1620,6 +1620,7 @@ func (v Value) SetCap(n int) {
|
||||
// SetMapIndex sets the value associated with key in the map v to val.
|
||||
// It panics if v's Kind is not 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,
|
||||
// and val's value must be assignable to the map's value type.
|
||||
func (v Value) SetMapIndex(key, val Value) {
|
||||
|
Loading…
Reference in New Issue
Block a user