Created
February 14, 2010 13:37
-
-
Save zimbatm/304025 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ 6g mapkey.go | |
$ 6l mapkey.6 | |
$ ./6.out | |
throw: runtime.mapaccess1: key not in map | |
panic PC=0x299ff8 | |
throw+0x3e /Users/zimbatm/Code/golang/src/pkg/runtime/runtime.c:74 | |
throw(0x4ae9d, 0x0) | |
runtime.mapaccess1+0x74 /Users/zimbatm/Code/golang/src/pkg/runtime/hashmap.c:772 | |
runtime.mapaccess1(0x2a8230, 0x0) | |
main.main+0xb5 /Users/zimbatm/Code/learn/golang/mapkey.go:8 | |
main.main() | |
mainstart+0xf /Users/zimbatm/Code/golang/src/pkg/runtime/amd64/asm.s:54 | |
mainstart() | |
goexit /Users/zimbatm/Code/golang/src/pkg/runtime/proc.c:140 | |
goexit() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import "fmt" | |
func main() { | |
var myMap = make(map[string]string); | |
myMap["message"] = "world"; | |
fmt.Printf("hello, %s\n", myMap["wrongkey"]) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment