cast to bytearray go code example Example: go string to byte array b := []byte("ABC€") s := string([]byte{65, 66, 67, 226, 130, 172})