go icon indicating copy to clipboard operation
go copied to clipboard

Wrap panics on derived types

Open rickb777 opened this issue 2 years ago • 0 comments

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.

rickb777 avatar Mar 22 '22 12:03 rickb777