Skip to content

Instantly share code, notes, and snippets.

@surma
Created June 21, 2011 12:43
Show Gist options
  • Save surma/1037778 to your computer and use it in GitHub Desktop.
Save surma/1037778 to your computer and use it in GitHub Desktop.
Unexpected behaviour of go linker?
package list
var List map[string]string = make(map[string]string)
package sublist1
import "list"
func init() {
list.List["sublist1"] = "whatever"
}
package sublist2
import "list"
func init() {
list.List["sublist2"] = "whatever"
}
package main
import (
"list"
)
func main() {
for k, v := range list.List {
println(k,"=>",v)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment