LEFT | RIGHT |
1 // Copyright 2009 The Go Authors. All rights reserved. | 1 // Copyright 2011 The Go Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style | 2 // Use of this source code is governed by a BSD-style |
3 // license that can be found in the LICENSE file. | 3 // license that can be found in the LICENSE file. |
4 | 4 |
5 // This file contains examples to embed in the Go 1 release notes document. | 5 // This file contains examples to embed in the Go 1 release notes document. |
6 | 6 |
7 package main | 7 package main |
8 | 8 |
9 import "log" | 9 import "log" |
10 | 10 |
11 func main() { | 11 func main() { |
12 mapDelete() | 12 mapDelete() |
13 } | 13 } |
14 | 14 |
15 func mapDelete() { | 15 func mapDelete() { |
16 m := map[string]int{"7": 7, "23": 23} | 16 m := map[string]int{"7": 7, "23": 23} |
17 k := "7" | 17 k := "7" |
18 delete(m, k) | 18 delete(m, k) |
19 if m["7"] != 0 || m["23"] != 23 { | 19 if m["7"] != 0 || m["23"] != 23 { |
20 log.Fatal("mapDelete:", m) | 20 log.Fatal("mapDelete:", m) |
21 } | 21 } |
22 } | 22 } |
LEFT | RIGHT |