They not only give the same resulting value, but also highlight something in both directions and look at their values ββ...
// Adapted from http://tour.golang.org/
... we will see that they are actually distributed in consecutive memory slots. Typical Output: 0x10328100 0x10328108 . I'm not sure if this is an implementation detail or part of a specification, but it shows that they are both allocated from the same pool.
Play here with the code.
As for initialization with new, according to the language specification : The built-in function new takes a type T and returns a value of type *T. The memory [pointed to] is initialized as described in the section on initial values. The built-in function new takes a type T and returns a value of type *T. The memory [pointed to] is initialized as described in the section on initial values. Since functions in go cannot be overloaded, and it isnβt a variational function, there is no way to pass any initialization data. Instead, go will initialize it with any version 0 makes sense for the type and any member fields, if necessary.
Ionoclast brigham
source share