Also see caveats discussed here https://groups.google.com/d/topic/golan
g-nuts/sKQtvluD_So/discussion
On Tue, 2018-08-28 at 17:00 +, 'Borman, Paul' via golang-nuts
wrote:
> You are only overwriting the pointer to the string (a string is
> essentially a pointer and a length). If you want to us
You are only overwriting the pointer to the string (a string is essentially a
pointer and a length). If you want to use memory and then zero it out, use a
byte slice instead and be careful to not call append where append might
allocate new memory. Take a look at https://play.golang.org/p/GkrKR
On Tue, Aug 28, 2018 at 6:45 PM Jay Sharma wrote:
> @Jan, The example you shown it is copying a string to new variable. but
my question was related to same variable.
> Will it overwrite the same memory or it will create some copy ?
The same concept applies as before. String variables are unique