Ho il seguente array di byte:Mettere int8 in array di byte
buf := make([]byte, 1)
var value int8
value = 45
buf[0] = value // cannot use type int8 as type []byte in assignment
E quando voglio mettere un valore char in array di byte ottengo l'errore che ho cannot use type int8 as type []byte in assignment
. Cosa c'è che non va? Come faccio a fare questo?
non so molto di 'go' ma hanno si sia accidentalmente fatto un array di un array? Oppure prova prima a lanciare int8 a byte. – Doomsknight
Possibile duplicato di [Converti un numero intero in un array di byte] (http://stackoverflow.com/questions/16888357/convert-an-integer-to-a-byte-array) –