1
0
mirror of https://github.com/golang/go synced 2024-11-25 07:07:57 -07:00

spec: calling delete on a nil map is a no-op

This is language change. It is a backward-compatible
change but for code that relies on a run-time panic
when calling delete on a nil map (unlikely).

Fixes #4253.

R=rsc, r, iant, ken, bradfitz, rogpeppe
CC=golang-dev
https://golang.org/cl/6909060
This commit is contained in:
Robert Griesemer 2012-12-12 13:08:35 -08:00
parent f85b94aa85
commit a9a49fe962

View File

@ -5104,9 +5104,8 @@ delete(m, k) // remove element m[k] from map m
</pre>
<p>
If the element <code>m[k]</code> does not exist, <code>delete</code> is
a no-op. Calling <code>delete</code> with a nil map causes a
<a href="#Run_time_panics">run-time panic</a>.
If the map <code>m</code> is <code>nil</code> or the element <code>m[k]</code>
does not exist, <code>delete</code> is a no-op.
</p>