Hi There,

At this stage of development it's unlikely to be a bug in Go's slice 
implementation.

I'd like to help but tbh your example is too long and I cannot follow what 
it does let alone what it should do.

Could you please do two thing for me; 

1. reduce the problem to the smallest possible case, which probably means 
deleting all of the lines that do work as you expect, leaving only the line 
which does not work.
2. write down in words, or in code, what you expected to happen.

It should be straight forward to explain from there.

Thanks

Dave

On Tuesday, 19 December 2017 14:03:47 UTC+11, Sasan Rose wrote:
>
> 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