In the golang language, there is also a way of using javascript.
like
func (a interface{}){
//1st element
if inst,ok:=a.(TypeA); ok{
inst.MethodA()
}
//Second item
switch inst:=a.(type){
case TypeA:
inst.MethodA()
default:
fmt.Println(“unknow”)
}
}
may be any type
a.(some kind of man) returns two or more values inst and ok, meaning whether or not this type of man, or if inst is the type of man
a.(type) type is a comma-separated string using
TypeA(a) is forced to translate
Similar Posts:
- Python TypeError: not all arguments converted during string formatting
- [Solved] Element-ui Error: [Vue warn]: Invalid prop: type check failed for prop “index”. Expected String with value “1”, got Number with value 1
- [Vue warn]: Invalid prop: type check failed for prop “index”. Expected String with value “1”, got Number with value 1.
- Vue3 vue.draggable slot jsx Error: Error: draggable element must have an item slot
- [Solved] Selenium Error: ElementClickInterceptedException
- The use of libpqxx interface in Linux solves the error of PSQL: connections on UNIX domain socket “/TMP/.S.pgsql.5432”
- Fast locating nonetype ‘object is not Iterable in Python
- Difference between normalize space (.) and normalize space (text ()) in XPath
- [Solved] vivado implementation Execute Error: Unsupported PLLE2_ADV connectivity…….
- How to Solve Java Error: java.util.Arrays$ArrayList cannot be cast to java.util.ArrayList