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?

-- 
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/58a7ab55-7fed-446c-bb4c-aab8298ccaa4n%40googlegroups.com.

Reply via email to