I have some generic code that uses reflection to handle struct fields. These fields may or may not include C types, referenced through Cgo.
One problem I encountered was that those aforementioned C types may be "incomplete structs", for instance:
typedef struct unknown u;. This can result in a panic later on in the code.
To avoid situations like this, I want to skip these fields. I found that doing a check on the reflect.Type where Size() returns 0 correctly tells me this:
if myType.Size() == 0 {
return
}
But I was wondering. are there any other instances where a reflect.Type will return a size of 0? In other words, is it possible any other types be skipped?