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

Change custom unmarshaling order #59

Merged
merged 1 commit into from Jun 9, 2022
Merged

Conversation

gust1n
Copy link
Contributor

@gust1n gust1n commented Jun 9, 2022

Since the input parsed by envconfig is most often configuration written
by humans, it makes sense to test unmarshaling as text before any other
formats. Also JSON should be more common than binary, so this commits
sets the order to:

  1. envconfig.Decoder
  2. encoding.TextUnmarshaler
  3. json.Unmarshaler
  4. encoding.BinaryUnmarshaler
  5. gob.GobDecoder

and adds tests to very that order. Closes #58.

@gust1n gust1n force-pushed the main branch 2 times, most recently from a4cbcaf to 683dd0a Compare June 9, 2022 06:11
Since the input parsed by envconfig is most often configuration written
by humans, it makes sense to test unmarshaling as text before any other
formats. Also JSON should be more common than binary, so this commits
sets the order to:
1. envconfig.Decoder
2. encoding.TextUnmarshaler
3. json.Unmarshaler
4. encoding.BinaryUnmarshaler
5. gob.GobDecoder

and adds tests to very that order. Closes sethvargo#58.
@gust1n gust1n marked this pull request as ready for review June 9, 2022 06:12
@sethvargo sethvargo merged commit 39c9bc7 into sethvargo:main Jun 9, 2022
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jun 17, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Swap order of encoding.TextUnmarshaler and encoding.BinaryUnmarshaler
2 participants