go
go copied to clipboard
Wrap panics on derived types
Referring to https://go.dev/play/p/V-1m3E14NO2
The result of running this is
- panic: interface conversion: interface {} is main.ID, not string
The reason is because ID is a derived type, but the Wrap function performs a hard type assertion to the predefined type string. The same problem would arise for most of the cases in the switch statement in Wrap.
This means that derived types cannot be used, which is a significant limitation.