go/types.Instantiate uses an assert helper in multiple places, leading to unhelpful "assertion failed" panics for external users. It would be nice if those would instead tell the user what they did wrong.
The type assertion to genericType also isn't the nicest it could be, as user error leads to a panic mentioning an unexported type--but at least the name is pretty indicative of what's wrong.
(It's unfortunate that Instantiate is documented not to return errors when validate is false, as most of the panics could've been errors instead.)
go/types.Instantiateuses anasserthelper in multiple places, leading to unhelpful "assertion failed" panics for external users. It would be nice if those would instead tell the user what they did wrong.The type assertion to
genericTypealso isn't the nicest it could be, as user error leads to a panic mentioning an unexported type--but at least the name is pretty indicative of what's wrong.(It's unfortunate that Instantiate is documented not to return errors when
validateis false, as most of the panics could've been errors instead.)