Wednesday 15 July 2015

Go string pointer to string -



Go string pointer to string -

is possible string value pointer string?

i'm using goopt package handle flag parsing , bundle returns *string only. want utilize these value phone call function in map.

as example.

var strpointer = new(string) *strpointer = "string" functions := map[string]func() { "string": func(){ fmt.println("works") }, } //do string value functions[strpointervalue]()

you can see problem demonstrated here http://play.golang.org/p/1s0-d-go-l

dereference pointer:

strpointervalue := *strpointer

pointers go

No comments:

Post a Comment