I have a function which simply returns the value of a map. However for some reasons it doesn't do that. Any idea why ? I've pasted here the code. You may also play it using
package main
import "fmt"
func main() {
a := CountryCode("Australia")
fmt.Println(a)
}
func CountryCode(s string) string {
m := make(map[string]string)
// [snip]
m["AU"] = "Australia"
// [snip]
return m[s]
}
func CodeByCountry(s string) string {
m := make(map[string]string)
// [snip]
m["Australia"] = "AU"
// [snip]
return m[s]
}