Is type casting a costly operation in Golang?

Owen Williams Responses • 2 Posted • Jun 3 2019
I am working with mongo and many of the mongo-driver methods return a slice or a map of interface{}. While processing these results I sometimes need the actual value of the returned results and have to do something like result.(string)

I am concerned whether this can turn out to be a costly operation if there are too many type casts (inside for loops) being done in my code

Also what is the difference between type assertions and type casting

Write your response...

On a mission to build Next-Gen Community Platform for Developers