--
You received this message because you are subscribed to the Google Groups "golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
If a constant was addressable, you could doconst x = 42x = 23fmt.Println(x) // 23so a constant wouldn't be constant anymore. The minimum Go would need, to make constants addressable would be some notion of const-pointers (that is, pointers which don't allow modification of the pointee).May I ask why it would be interesting to take the address of a constant?
On Mon, Aug 21, 2017 at 7:23 AM, chou <lock...@gmail.com> wrote:
I guess that const will be substitute literally at compile timefor performance improvements. So there is not such variable inrun time.Is it right?
--
You received this message because you are subscribed to the Google Groups "golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts...@googlegroups.com.
I have been already faced to this case. I usually use go swagger to generate the model from swagger spec. Go swagger generates some structure with field pointer (for example for string) where I always put the same value. The workaround, that I usually use, is to use global variable instead of global constant.
-j