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

Allow defaults library to use UnmarshalText() and UnmarshalJSON() #40

Merged
merged 1 commit into from
Mar 13, 2023

Conversation

HRogge
Copy link
Contributor

@HRogge HRogge commented Feb 17, 2023

Existing go types cannot easily be extended by a SetDefaults() function, but they often have an implementation of encoding.TextUnmarshaler and/or json.Unmarshaler interface.

Check for implementation of these two interfaces and try to set a default directly to allow initialization of additional types with this API, e.g. types of the net and netip package.

@HRogge
Copy link
Contributor Author

HRogge commented Mar 6, 2023

Any comment on this PR? I think the build checks fail because of an outdated docker container.
I checked the code locally, both tests and coverage work fine. Anything I can do to improve the PR?

@glebarez
Copy link

glebarez commented Mar 6, 2023

Same demand. #41

@creasty
Copy link
Owner

creasty commented Mar 13, 2023

(I'm sorry for not getting back to you sooner. Had a lot on my plate last week...)

Great idea! Much obliged!

I think the build checks fail because of an outdated docker container.

Fixed on my end.

@creasty creasty merged commit 3f98836 into creasty:master Mar 13, 2023
@creasty
Copy link
Owner

creasty commented Mar 13, 2023

Released v1.7.0

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.

3 participants