Don't understand the Go errors. New to Coding in Go. Appreciate any help in reviewing

Looking for a little question.

Sorry. Totally new to the forum thing. Just trying to meet the criteria below:

Write a Bubble Sort program in Go. The program should prompt the user to type in a sequence of up to 10 integers. The program should print the integers out on one line, in sorted order, from least to greatest. Use your favorite search tool to find a description of how the bubble sort algorithm works.
As part of this program, you should write a function called BubbleSort() which takes a slice of integers as an argument and returns nothing. The BubbleSort() function should modify the slice so that the elements are in sorted order.
A recurring operation in the bubble sort algorithm is the Swap operation which swaps the position of two adjacent elements in the slice. You should write a Swap() function which performs this operation. Your Swap() function should take two arguments, a slice of integers and an index value i which indicates a position in the slice. The Swap() function should return nothing, but it should swap the contents of the slice in position i with the contents in position i+1.

So what exactly is the problem you have with this description?

Having an error at the end of this code -

package main

import (

var toBeSorted = [10]int{1, 3, 2, 4, 8, 6, 7, 2, 3, 0}

func bubbleSort(input [10]int) {
// n is the number of items in our list
n := 10

//set swapped to true
swapped := true
// loop
for swapped {
	// set swapped to false
	swapped = false
	// iterate through all of the elements in our list
	for i := 1; i < n; i++ {
		// if the current element is greater than the next
		// element, swap them
		if input[i-1] > input[i] {
			// log that we are swapping values for posterity
			// swap values using Go's tuple assignment
			input[i], input[i-1] = input[i-1], input[i]
			// set swapped to true - this is important
			// if the loop ends and swapped is still equal
			// to false, our algorithm will assume the list is
			// fully sorted.
			swapped = true
// finally, print out the sorted list

func(sli []int) {
	sli[0] = sli[0] + 1
	if err != nil {
	i := []int{1}
	sli = i
	fmt.Println((int)sli + 1)

	// func main() {
	// 	fmt.Println("Hello World")
	// 	BubbleSort(toBeSorted)
	// }


What error?

Is that even the same code as in the playground?

The error in the playground is easily fixable by removing the output line that’s marked. It’s probably for debugging only anyway. Though then you get more errors because of undefined variables and unused values.

Remove references to unused values or declare them first. Use unused values.

Ask concrete questions, not just throw code without comments at us.


Thank you for your time and help!