-
Notifications
You must be signed in to change notification settings - Fork 4
Description
Right now code is not able to work with type aliases.
And an error will be reported at runtme
The issue is present with Convert that was recently added, but also maybe with all existing methods.
The solution might require a large refactoring.
The issue was found in the following PR spiffe/spire#5737 when they tried to use my lib
Having looked at the https://github.com/ccoVeille/go-safecast package a bit more closely, I actually think we're better off implementing the functionality we need from it ourselves, at least for now.
Specifically, the issue is that
safecast.MustConverttakes ananyargument, instead of being generic over the input type, meaning there are missed opportunities where things that could be compile-time errors are runtime errors.I'll update this PR accordingly (though eventually maybe the go-safecast package can also be improved).
Originally posted by @c4rlo in spiffe/spire#5737 (comment)