Is there an established pattern for getting pointers to non-composite literals?
x := 5 y := &x
The code above works, but terribly detailed.
If I understand correctly that the only point x is to highlight int , I recommend something even more βverboseβ:
x
int
y := new(int) *y = 5
I donβt see it being shorter than yours. Since the & operator requires that its operand be either an addressable or a compound literal, you either get stuck doing what you are doing to get something addressed, or you can do what I suggest and avoid & in general.
&