for
loop instead of append
SCC-S1011There is no need to range
over the slice and append elements one by one;
instead, use append
because it's clear, simple, and idiomatic.
a := []int{1, 2}
b := []int{3, 4}
for _, v := range a {
b = append(b, v)
}
a := []int{1, 2}
b := []int{3, 4}
b = append(b, a...)