aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKeith Randall <khr@golang.org>2014-05-23 17:39:58 -0700
committerKeith Randall <khr@golang.org>2014-05-23 17:39:58 -0700
commit4b3019b17ce8fcf0b9fab916897aaee9b24ce7fc (patch)
treee529459e2ceebe48b7482ab93d854e65e30bf5c1
parent05cc78d8d32f6af6fc4373e10da0b4a12f0a1ad4 (diff)
downloadgo-4b3019b17ce8fcf0b9fab916897aaee9b24ce7fc.tar.gz
go-4b3019b17ce8fcf0b9fab916897aaee9b24ce7fc.zip
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
-rw-r--r--doc/go1.3.html6
-rw-r--r--src/pkg/reflect/value.go1
2 files changed, 7 insertions, 0 deletions
diff --git a/doc/go1.3.html b/doc/go1.3.html
index d98cdf629f..9a9f9f8d46 100644
--- a/doc/go1.3.html
+++ b/doc/go1.3.html
@@ -510,6 +510,12 @@ 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>
and all other goroutines finish execution, the program now always crashes,
diff --git a/src/pkg/reflect/value.go b/src/pkg/reflect/value.go
index 2cbda3983c..576cbc3984 100644
--- a/src/pkg/reflect/value.go
+++ b/src/pkg/reflect/value.go
@@ -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) {