I am looking to convert a string array to a byte array in GO so I can write it down to a disk. What is an optimal solution to encode and decode a string array ([]string
[]string
to convert []string to []byte
[]byte
var str = []string{"str1","str2"} var x = []byte{} for i:=0; i
to convert []byte to string
string
str := "" var x = []byte{'c','a','t'} for i := 0; i < len(x); i++ { str += string(x[i]) }