string
and []byte
CRT-A00071655 }
1656
1657 existingConfig := atc.ResourceConfig{}
1658 if string(decryptedConfig) != "" {1659 err = json.Unmarshal(decryptedConfig, &existingConfig)
1660 if err != nil {
1661 return false, err
Conversion 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)