That's what the reflect package does, https://play.golang.org/p/M7gNcKjOmMM
-- Marcin On Tue, May 21, 2019 at 8:15 PM <i...@marczahn.de> wrote: > Hi, > > for a code generator I want to get a type of a string which is passed by > an argument by go generate. So I have sth. like "[]int" and now I need to > know if it is a slice/rangeable, of type int etc. Is this somehow possible? > > I cannot have a predefined map from strings to types because it is > supposed to be generic. > > -- > You received this message because you are subscribed to the Google Groups > "golang-nuts" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to golang-nuts+unsubscr...@googlegroups.com. > To view this discussion on the web visit > https://groups.google.com/d/msgid/golang-nuts/8d9ca631-8737-4c2d-99dc-bbbc37e334e7%40googlegroups.com > <https://groups.google.com/d/msgid/golang-nuts/8d9ca631-8737-4c2d-99dc-bbbc37e334e7%40googlegroups.com?utm_medium=email&utm_source=footer> > . > For more options, visit https://groups.google.com/d/optout. > -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/golang-nuts/CA%2Bv29Lvi5%3DOENjXmuEnWQEcn7BD1rhYR6G7Ef2_nqzQaA_iGzQ%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.