Handle Type Assertion Failures

The single return value form of a type assertion will panic on an incorrecttype. Therefore, always use the "comma ok" idiom.

BadGood
  1. t := i.(string)
  1. t, ok := i.(string)
  2. if !ok {
  3. // handle the error gracefully
  4. }