vendredi 15 mai 2015

Mysterious type assertion failure?

Under what circumstances could this code:

        v, ok := value.(int64)
        if !ok  {
            panic("NOPE "+reflect.TypeOf(value).Kind().String())
        } else {
            fmt.Printf("VAL: %d\n",v)
        }

produce the panic with message panic: NOPE int64?

Is this a bug or is there something basic about the numeric types that I'm missing?





Aucun commentaire:

Enregistrer un commentaire