casting pointers in golang
- You have a type eg.
type Poop string, Say variableyeetis of typePoop - Now there’s a struct
Yolothat has fielddoopwhich accepts*string - To assign
yeettodoop, we do{ ... doop: (*string)(&yeet) }
type Poop string, Say variable yeet is of type PoopYolo that has field doop which accepts *stringyeet to doop, we do
{
...
doop: (*string)(&yeet)
}