Skip to content

issue with type alias #72

@ccoVeille

Description

@ccoVeille

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)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions