This seems like it should be simple but I can't find it. How can I create a reflect.Type for a built-in type *without* starting from an instance? Something like a set of Type constants, reflect.IntType, reflect.StringType etc. for all bulit-in types.
I'd like to do this: func myChanT(t reflect.Type) interface{} { ch = reflect.MakeChan(t, n); ... something...; return ch.Interface() } and then be able to call myChanT to create a channel of int: ch := myChan(reflect.IntType) I could make my own constants: const ( UIntType Type = TypeOf(uint(0)) .... } but it seems strange that it isn't already in the reflect package. I could also have myChan operate on an existing channel and reflect on that: func myChanT(ch interface{}) { ...reflect on ch... } but I would prefer to control the creation and direction-safety of my channels, i.e. I want myChanT to make a chan T internally, but return a ->chan T or a chan-> T to ensure the caller can't mess with the wrong end. -- 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. For more options, visit https://groups.google.com/d/optout.