Is there a way to iterate over a slice in reverse in Go?

It would be convenient to be able to say something like:

for _, element in reverse range mySlice {
        ...
}

No there is no convenient operator for this to add to the range one in place. You’ll have to do a normal for loop counting down:

s := []int{5, 4, 3, 2, 1}
for i := len(s)-1; i >= 0; i-- {
   fmt.Println(s[i])
}

Refer: stackoverflow.com