I'm sure this is just a syntax thing I'm not aware of but this is the struct with pointer fields:
type someStruct struct {
StringVal string `json:"val_str"`
IntVal *int64 `json:"val_int"`
}
I'm trying to return an instance of this struct like so, where aValue
is an int64
value and I'm trying to get the IntVal
pointer to point to it:
return someStruct{IntVal: &(int64(aValue))}
I get this error:
cannot take the address of int64(d)
Any ideas how to achieve this?