From 4b3019b17ce8fcf0b9fab916897aaee9b24ce7fc Mon Sep 17 00:00:00 2001 From: Keith Randall Date: Fri, 23 May 2014 17:39:58 -0700 Subject: [PATCH] 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 --- doc/go1.3.html | 6 ++++++ src/pkg/reflect/value.go | 1 + 2 files changed, 7 insertions(+) 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 @@ -509,6 +509,12 @@ In particular, it only calls LookPath +
  • +The SetMapIndex +function in the reflect package +no longer panics when deleting from a nil map. +
  • +
  • If the main goroutine calls runtime.Goexit 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) { -- 2.50.0