I'm puzzled as why this code doesn't work: package main import ( "fmt" "sort" ) type T [2]int func (t T) Len() int { return len(t) } func (t T) Swap(i, j int) { t[i], t[j] = t[j], t[i] } func (t T) Less(i, j int) bool { return t[i] < t[j] } func main() { var x = [2]int{1, 0} fmt.Println(x) sort.Sort(T(x)) fmt.Println(x) } It outputs (incorrectly): [1 0] [1 0] Changing the type of T to slices does