Check out example codes for "bubble sort in golang". It will help you in understanding the concepts better.

Code Example 1

package main

import (
	"fmt"
	"os"
	"strconv"
)

func bubblesort() {

	unsorted := os.Args[1:]
	var data [5]int
	for i, n := range unsorted {
		value, err := strconv.Atoi(n)
		data[i] = value
		if err != nil {
			data[i] = 0
		}
	}

	for i := 0; i < len(data)-1; i++ {

		for j := 0; j < len(data)-i-1; j++ {

			if data[j] > data[j+1] {
				data[j], data[j+1] = data[j+1], data[j]
			}
		}

	}
	fmt.Println(data)
}

Learn ReactJs, React Native from akashmittal.com