string
and []byte
CRT-A0007Conversion between string
and []byte
is not required here, and it is better
to pass the string
as copy's argument as it is without type conversing it to
[]byte
.
The builtin function copy
takes care of byte
to string
(or vice-versa)
conversion of the args passed, and hence, does not require that an explicit
conversion be done when passing the arguments. Hence, the conversion can be
omitted.
copy(b, []byte(s))
copy(b, s)