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

use type assertions instead of reflect #4

Merged
merged 1 commit into from Nov 27, 2018
Merged

Conversation

seebs
Copy link
Contributor

@seebs seebs commented Nov 27, 2018

You can type-assert to interfaces, even in cases where
this is "upgrading" to a more-restrictive interface which
needs additional fields, as long as the underlying concrete
type implements the interface.

I wasn't 100% sure about this, but I did some test cases
and it worked. (Then it failed because my copy of spf13/pflag
was too old to handle IP masks, but updating it fixed that.)

You can type-assert to interfaces, even in cases where
this is "upgrading" to a more-restrictive interface which
needs additional fields, as long as the underlying concrete
type implements the interface.

I wasn't 100% sure about this, but I did some test cases
and it worked. (Then it failed because my copy of spf13/pflag
was too old to handle IP masks, but updating it fixed that.)
Copy link
Owner

@jaffee jaffee left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

gorgeous

@jaffee jaffee merged commit 719d29f into jaffee:master Nov 27, 2018
@seebs seebs deleted the reflective branch November 27, 2018 20:52
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 this pull request may close these issues.

None yet

2 participants