In my Go code I want to make an array of custom data type. I call
Blocks=make(*BlockData, len(blocks))
and I get error:
cannot make type *BlockData
my class BlockData contains such field types as uint64, int64, float32, string, []byte, []string and []*TransactionData. The last one is an array of pointers to another custom class of mine.
What should I do to fix this error?
make()is used to create slices, maps and channels. The type name must have[]before it when making a slice.Use this to make a slice of pointers to BlockData.
Read more in the Go language specification.