Say I have something like this:
type Foo struct{
Bar string
}
func Exported (v interface{}){
// cast v to Foo
}
is there a way to cast v to Foo in the Exported func?
I tried a type assertion like so:
func Exported (v interface{}){
v, ok := v.(Foo)
if !ok {
log.Fatal("oh fuk")
}
// but v.Bar is not available here tho ??
}
The problem is that if I try to access v.Bar after the assertion, it doesn't compile.