Created
June 21, 2011 12:43
-
-
Save surma/1037778 to your computer and use it in GitHub Desktop.
Unexpected behaviour of go linker?
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 list | |
var List map[string]string = make(map[string]string) |
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 sublist1 | |
import "list" | |
func init() { | |
list.List["sublist1"] = "whatever" | |
} |
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 sublist2 | |
import "list" | |
func init() { | |
list.List["sublist2"] = "whatever" | |
} |
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 ( | |
"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