If you are new to Golang like you were probably stuck on this error for a good 10 minutes at least when trying to combine to two byte arrays.

var array1 = make([]byte, 0)
var array2 = make([]byte, 0)
array1 = append(array1, array2)

This will error out with “Cannot use variable (variable of type []byte) as byte value in argument to append”. You don’t need to go code your own function to append every byte into the first array (what my first reflex was). Turns out append is a variadic function and you can just use the ellipsis notation as follows:

var array1 = make([]byte, 0)
var array2 = make([]byte, 0)
array1 = append(array1, array2...)

Hope this helps!