I'm trying to convert a fixed size array [32]byte
to variable sized array (slice) []byte
:
package main
import (
"fmt"
)
func main() {
var a [32]byte
b := []byte(a)
fmt.Println(" %x", b)
}
but the compiler throws the error:
./test.go:9: cannot convert a (type [32]byte) to type []byte
How should I convert it?