Go Newb here -- I've encountered the following bit of Go code that I didn't write
if tc, ok := tng.(ThingClasser); ok {
//... do some stuff ...
}
I won't understand the semantics of tng.(ThingClasser)
.
In some ways this looks like a method call -- i.e. there are two variables (ec
, ok
) sitting there ready to accept multiple return values.
However, tng.(ThingClasser)
itself looks like its a property access, not a method call.
However however, the parens around ThingClasser
are a wrinkle I've never seen before. Also, if it matters, the ThingClasser
symbol is defined elsewhere in this project as an interface, so I think maybe this is some syntactic sugar around an does this implement an interface -- but then the two return values confused me.
Googling hasn't turned up anything concrete, but this is one of those hard things to google for.
Does anyone here know what this call/syntax is in GoLang, and possible point me at the relevant manual pages so I can RTFM?