Hey, 

The following code <https://go.dev/play/p/P2gPMHKuJW8> allows elements 
outside the length of the slice to be accessed.
Is this the expected behaviour or a bug?

Thanks
```
package main

import "fmt"

func main() {
foo([]int{1, 2, 3, 4}[0:1])
}

func foo(bar []int) {
fmt.Println(len(bar)) // Output: 1
fmt.Println(bar[0:3]) // Output: [1,2,3]
}
```

-- 
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.
To view this discussion visit 
https://groups.google.com/d/msgid/golang-nuts/71c52f83-a956-449d-8e5b-adf1a9ebfbb4n%40googlegroups.com.

Reply via email to