Today I Learned

hashrocket A Hashrocket project

`new` returns a pointer, not a value

Go has pointers, which is great, I've never worked in a language with legit pointers before. The built-in function new returns a pointer.

p := new(int)

p is now a pointer. You can access the value of the pointer with the * syntax.


The above returns 0.

Read the documentation about new with:

go doc
See More #go TILs