Please take a look at https://play.golang.org/p/BL4LUGk-lH

I think I know how slices work (The 3-word structure). I tried to do my 
homework. But still I think I'm missing something here or it's really a bug.

So In my code as you can see I'm appending to an slice (a variable called 
slice obviously) and removing from the beginning of it in a series of 
random operations (Actually it's not random it was happening in a loop but 
I tried to reproduce it this way). The problem is always at the last step 
(I separated each step by "=" signs) when I append to the array the (n-1)th 
element of array also changes to the appended value (This only happens when 
I create the appended value by appending an int to 'solutionNew' variable).

Am I doing something wrong? Is this an intended behaviour? or is this 
really a bug? If I'm missing something I would be grateful if someone could 
explain it to me or share a reference with me so I can understand why this 
is happening. Thanks a lot.

-- 
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.

Reply via email to