Why does calling .Bytes()
on a zero value big.Int
return a slice of length 0?
// uint64
var x uint64
xb := make([]byte, 8)
binary.BigEndian.PutUint64(xb, x)
// [0 0 0 0 0 0 0 0]
fmt.Println(xb)
// uint8
var y uint8
yb := []byte{byte(y)}
// [0]
fmt.Println(yb)
// big.Int
z := big.Int{}
zb := z.Bytes()
// [] Why is this an empty slice and not [0]
fmt.Println(zb)