lundi 7 août 2023

How to get the reflection type if I know the type name? [duplicate]

The following defines the type "Symbol" and stores the type in "SymbolType".

import (
    "reflect"
)

type Symbol string

var SymbolType reflect.Type = reflect.TypeOf(Symbol(""))

Is it possible to do this without creating an instance of "Symbol"?





Aucun commentaire:

Enregistrer un commentaire