dimanche 20 septembre 2020

Can someone explain this result?

There is a demo about go reflection:

func main() {
        test := []string{"hello"}
        V := reflect.ValueOf(test)
        if reflect.TypeOf(V).Kind() == reflect.Struct{
            fmt.Printf("it's a struct")
        } else {
            fmt.Printf("other")
        }
    }

and the output is "it's a struct"





Aucun commentaire:

Enregistrer un commentaire