mirror of
https://github.com/golang/go
synced 2024-11-11 22:20:22 -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:
parent
f85b94aa85
commit
a9a49fe962
@ -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>
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user