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.
Referring to https://go.dev/play/p/V-1m3E14NO2
The result of running this is
The reason is because
ID
is a derived type, but theWrap
function performs a hard type assertion to the predefined typestring
. The same problem would arise for most of the cases in the switch statement inWrap
.This means that derived types cannot be used, which is a significant limitation.