go - Golang Cast interface to struct - Stack Overflow
Jun 19, 2018 · To have a safe cast, you use: v, ok = i.(T) and if the underlying type is not T, ok is set to false, otherwise true. Note that T can also be an interface type and if it is, the code cast i into a new interface instead of a concrete type. And please be noted, casting an interface is likely a symbol of bad design.
DA: 42 PA: 5 MOZ Rank: 99