diff --git a/doc/effective_go.html b/doc/effective_go.html index edaffd733d1a9956039b533079b66237cfdc89e6..e3e19bd392dc26c393a787605e86f527a1f2590f 100644 --- a/doc/effective_go.html +++ b/doc/effective_go.html @@ -1418,13 +1418,13 @@ identifier in place of the usual variable for the value. _, present := timeZone[tz] </pre> <p> -To delete a map entry, turn the multiple assignment around by placing -an extra boolean on the right; if the boolean is false, the entry -is deleted. It's safe to do this even if the key is already absent +To delete a map entry, use the <code>delete</code> +built-in function, whose arguments are the map and the key to be deleted. +It's safe to do this this even if the key is already absent from the map. </p> <pre> -timeZone["PDT"] = 0, false // Now on Standard Time +delete(timeZone, "PDT") // Now on Standard Time </pre> <h3 id="printing">Printing</h3> diff --git a/doc/effective_go.tmpl b/doc/effective_go.tmpl index 88754950733f8ebaa819fad900c6e5aa91d40f0e..5763cacdabafb892d422e2b4531b684f212ed97e 100644 --- a/doc/effective_go.tmpl +++ b/doc/effective_go.tmpl @@ -1414,13 +1414,13 @@ identifier in place of the usual variable for the value. _, present := timeZone[tz] </pre> <p> -To delete a map entry, turn the multiple assignment around by placing -an extra boolean on the right; if the boolean is false, the entry -is deleted. It's safe to do this even if the key is already absent +To delete a map entry, use the <code>delete</code> +built-in function, whose arguments are the map and the key to be deleted. +It's safe to do this this even if the key is already absent from the map. </p> <pre> -timeZone["PDT"] = 0, false // Now on Standard Time +delete(timeZone, "PDT") // Now on Standard Time </pre> <h3 id="printing">Printing</h3>