I'm trying to work out how to return a map when calling a function in Go. I can't seem to find anything documented anywhere on this. This is what I've tried so far:
func test() map {
// Get Auth Token (POST https://192.168.13.234/aperture/api/users/authorize)
anotherMap := map[string]string{"a": "b", "c": "d"}
return anotherMap
}
The return map type must be fully defined.
Playground: http://play.golang.org/p/26LFrBhpBC
func test() map[string]string {
anotherMap := map[string]string{"a": "b", "c": "d"}
return anotherMap
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With