如何在Go中使用数组范围添加嵌套循环的索引?

I am working on printing the index of the numbers that leads to the sum that is entered through input by user. I have basically used the tradition method of using two loops of i & j and iterate until array length. However, when it comes to Go Language, we do have an option of getting index & key value of array using a different format in Go.

Here's my working code:

func findKIndex(arr []int, k int) (int, int) {
    index1, index2 := 0, 0
    Length := len(arr)
    for i := 0; i < Length; i++ {
        for j := i + 1; j < Length; j++ {
            if arr[i]+arr[j] == k {
                index1 = i
                index2 = j
            }
        }
    }
    return index1, index2
}

How do I do the same thing using :

for idx, key := range arr{
    for idx2, key2 := range arr {
        //statements
    }
}

Basically, I am not able to figure out initiating the inner index with +1 of outer index or may do it in a single loop.

Just iterate over a slice starting at idx+1:

https://play.golang.org/p/KDITT8zQ6q-

for idx, key := range arr{
    for idx2, key2 := range arr[idx+1:] {
        //actual second index is idx + idx2 + 1
        //statements
    }
}