& just returns an memory address and a variable is just that, a memory address. That the reason you can not apply & to a type...
El dom., 10 mar. 2019 a las 10:41, 박민우 (<minwoo33p...@gmail.com>) escribió: > I am new to Go and I have read Go;s-declaration-syntax > <https://blog.golang.org/gos-declaration-syntax> documentation. > > It states that: > > p: pointer to int > > Would be written as: > p *int > > However, other than declaration syntax, "&" is the symbol for "the pointer > to" like, > q := &int > The above code would be the same as: > var q *int > q = new(int) > So, I would suggest, > var q &int > to be more consistent, but Go's syntax wouldn't permit this. > > Is there a reason behind this decision? > I will get used to the syntax after a while, but in need of some > reasonable explanation. > > Thanks for any help! > > -- > 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+unsubscr...@googlegroups.com. > For more options, visit https://groups.google.com/d/optout. > -- 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+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.