我正在尝试将切片[1, 2]和切片组合在一起[3, 4].我怎么能在Go中这样做?
我试过了:
append([]int{1,2}, []int{3,4})
Run Code Online (Sandbox Code Playgroud)
但得到了:
cannot use []int literal (type []int) as type int in append
Run Code Online (Sandbox Code Playgroud)
但是,文档似乎表明这是可能的,我错过了什么?
slice = append(slice, anotherSlice...)
Run Code Online (Sandbox Code Playgroud)