Hello Community.
My first time posting and writing for golang.
I am making a Golang struct.
The struct types are correct, but the struct initialization gives me errors.
I am using struct inside struct multiple times.
The link to Go Playground with the Example
Errros shown: ./prog.go:45:4: undefined: Amount ./prog.go:45:4: cannot use TheAmount{...} (type TheAmount) as type PurchaseUnits in slice literal
I got the same errors for every field, how could i solve this?
Thanks Friends!
The Purchase_units field’s type is []PurchaseUnits But you’re putting fields in there like Address, etc., as if it were a single PurchaseUnits struct. If you want a slice of PurchaseUnits, then add a second set of { and } inside of your []PurchaseUnits on line 44.