Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

issue with type alias #72

Closed
ccoVeille opened this issue Feb 1, 2025 · 0 comments · Fixed by #81
Closed

issue with type alias #72

ccoVeille opened this issue Feb 1, 2025 · 0 comments · Fixed by #81

Comments

@ccoVeille
Copy link
Owner

ccoVeille commented Feb 1, 2025

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.MustConvert takes an any argument, 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)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant