package main import "fmt" func main() { var nums = [] int{5, 4, 3, 2, 1, 4, 5, 3} sort(nums, len(nums)) fmt.Println(nums) } func sort(nums []int, length int) { for i := 0; i < length; i++ { for j := 0; j < length; j++ { if (nums[i] > nums[j]) { swap(&nums[i], &nums[j]) } } } } func swap(a *int, b *int) { *a, *b = *b, *a }