On Fri, Nov 7, 2025 at 9:47 AM Roel van der Goot
<[email protected]> wrote:
>
> package main
>
> import "fmt"
>
> func main() {
> slice := []int{1, 2}
> rest := append(slice[:0], slice[1:]...)
> fmt.Printf("slice = %+v, rest = %+v\n", slice, rest)
> }
>
> Actual output:
> slice = [2 2], rest = [2]
> Expected output:
> slice = [1 2], rest = [2]
>
> https://go.dev/play/p/GU5h_45dPg9
>
> Go 1.25.3 and 1.25.4
>
> Am I missing something?

Please see https://go.dev/blog/slices .

Ian

-- 
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 [email protected].
To view this discussion visit 
https://groups.google.com/d/msgid/golang-nuts/CAOyqgcVftnDgoq1V9tZdhUs%2BTL8MG0nvADrAZpifLY8bweCSpA%40mail.gmail.com.

Reply via email to