package main import ( "fmt" ) func main() { a := []int{1, 2, 3, 4, 5} for i := len(a)/2 - 1; i >= 0; i-- { opp := len(a) - 1 - i a[i], a[opp] = a[opp], a[i] } fmt.Println(a) }