go sorting array code example Example: Sort an array in Go s := []int{4, 2, 3, 1} sort.Ints(s) fmt.Println(s) // [1 2 3 4]