Golang代码生成特定的顺序单词组合?

I'm trying to write a code in GoLang and am struggling, as am still learning a lot. I would like a code that would do the following:

Generate list of sequential combinations of two words, for example

Word Group One: A, B, C, ..... J

Word Group Two: K, L, M, ..... T

List needed:

Test_A_K, Test_A_L, Test_A_M,

etc

Test_B_K, Test_B_L, Test_B_M,

etc

for all combinations of "Test_Word Group One_Word Group Two"

Ive tried to implement some other codes from this site, but am not sure if i am doing the correct thing - any pointers would be most appreciated

Thanks!!

You probably need a nested for loop. For example,

package main

import "fmt"

func pairs(words1, words2 []string) []string {
    pairs := make([]string, 0, len(words1)*len(words2))
    for _, word1 := range words1 {
        for _, word2 := range words2 {
            pairs = append(pairs, word1+"_"+word2)
        }
    }
    return pairs
}

func main() {
    w1 := []string{"a", "b", "c", "j"}
    fmt.Printf("%q
", w1)
    w2 := []string{"k", "l", "m", "t"}
    fmt.Printf("%q
", w2)
    p := pairs(w1, w2)
    fmt.Printf("%q
", p)
}

Output:

["a" "b" "c" "j"]
["k" "l" "m" "t"]
["a_k" "a_l" "a_m" "a_t" "b_k" "b_l" "b_m" "b_t" "c_k" "c_l" "c_m" "c_t" "j_k" "j_l" "j_m" "j_t"]