I have a function that returns a string
, and a structure that wants a string*
. Currently I'm doing this https://play.golang.org/p/rFfeONFS33
stupid := a()
y.z = &stupid
What I want (doesn't work) https://play.golang.org/p/Hhh8GP7JJl
z.y = &(a())
Is this because returned values are using the stack? Is there a more elegant way than allocating some other variable with a nonsense name?