Slices combine a mutable vector with a (seemingly) read-only view – a big mistake in #Go, leading to the foot-guns here & in the discussions 😓:

“Sliced By Go’s Slices”, Ohad Ravid (https://ohadravid.github.io/posts/2026-02-go-sliced/).

Via Lobsters: https://lobste.rs/s/o3cpxf/sliced_by_go_s_slices

#Programming #GoLang #PLDI

Sliced by Go’s Slices

Today, I was sliced by Go’s slices. Actually, by Go’s variadics. Question: what does this snippet print? func main() { nums := []int{1, 2, 3} …