1 package main 2 3 import "fmt" 4 5 func sort(array []int) { 6 length := len(array) 7 for i := 0; i < length-1; i++ { 8 for j := i + 1; j < length; j++ { 9 if array[i] > array[j] { 10 array[i], array[j] = array[j], array[i] 11 } 12 } 13 } 14 } 15 16 func main() { 17 array := []int{9, 2, 10, 1, 5, 7, 3, 4, 8} 18 sort(array) 19 fmt.Println(array) 20 }