How to get the string value from a pointer to a string in Go?

Is it possible to get the string value from a pointer to a string?

I'm using the goopt package to handle flag parsing and the package returns *string only. But I want to use these value to call a function in a map.

As an example.
var strPointer = new(string) *strPointer = "string" functions := map[string]func() { "string": func(){ fmt.Println("works") }, } //Do something to get the string value functions[strPointerValue]()

You can see the problem demonstrated here http://play.golang.org/p/1s0-d-GO-L

Write your answer...

Never miss a post from Aditya Agrawal, when you sign up for Ednsquare.