Take for example the following code:
https://play.golang.org/p/vjux0TYz0D
It seems that, depending on the type held by the slice, append will sometimes "copy" the initial slice (the one append is called upon) and other times it will leave it pointing to the same underlying array.
Is this behavior defined, assuming the code:
a := []type{value1}
b := append(a, value2)
Is there any way of knowing if after the second operation a and b are pointing to the same memory ? Can I modify a or b in such a way that I am 100% sure the other is not modified ? Can the 'a' point to a completely different memory location after append ? Should 'a' just be considered garbage with undefined behavior after append is called on it ?