Reverse Map Data Structures

I am trying to work out how to return a map when a function is called in Go. I can't seem to find anything in this document. This is what I have 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
}

      

+3


source to share


1 answer


The type of return card must be fully specified.

Playground: http://play.golang.org/p/26LFrBhpBC



func test() map[string]string {
    anotherMap := map[string]string{"a": "b", "c": "d"}
    return anotherMap
}

      

+8


source







All Articles