Given:
type MyInterface interface{
MyMethod() int
}
var im MyInterface
...
If I call:
switch t := im.(type) {
case:....
default:...
}
What is the actual type of the variable t
when it is declared? To illustrate the question: If I wanted to write
var t //What type should I use?!
How would I declare t
?
For example In Delphi we have this structure:
TTypeInfo = record
Kind: TTypeKind;
Name: string;
{TypeData: TTypeData}
end;
I believe I am looking for something in GoLang that is akin to TTypeKind
, which has potential values such as tkInteger
, tkString
etc.
In C++, we find the type_info
class type, which also provides some of this functionality.
What type would I use for t
in the var t...
declaration? Is this even possible?