The bubble sort algorithm is a sorting algorithm that compares a pair of neighboring elements and swaps them if they are in the wrong order

package main

import (
  "fmt"
)

//bubble Sorter 
func bubbleSorter(integers [11]int) {

    isSwapped := true
    for isSwapped {
   
    isSwapped = false
    for i := 1; i < len(integers); i++ {
      if integers[i-1] > integers[i] {
	// swap routine
	temp := integers[i]
        integers[i] = integers[i-1]
        integers[i-1] = temp
        isSwapped = true
      }
    }
  }
  fmt.Println(integers)
}

func main() {
  // integers := [11]int{31, 13, 12, 4, 18, 16, 7, 2, 3, 0, 10} short form
  var integers = [11]int{31, 13, 12, 4, 18, 16, 7, 2, 3, 0, 10}
 
  fmt.Println("Bubble Sorter")
  bubbleSorter(integers)

}

https://play.golang.org/p/1ob1N-sZKmp

Note: No nested loop used help in reducing the unnecessary looping of all element even a single pair of the unsorted list.