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

Make Unmarshal work with AutomaticEnv #1699

Closed
wants to merge 2 commits into from
Closed

Conversation

Signed-off-by: Mark Sagi-Kazar <mark.sagikazar@gmail.com>
Signed-off-by: Mark Sagi-Kazar <mark.sagikazar@gmail.com>
Copy link

github-actions bot commented Dec 5, 2023

👋 Thanks for contributing to Viper! You are awesome! 🎉

A maintainer will take a look at your pull request shortly. 👀

In the meantime: We are working on Viper v2 and we would love to hear your thoughts about what you like or don't like about Viper, so we can improve or fix those issues.

⏰ If you have a couple minutes, please take some time and share your thoughts: https://forms.gle/R6faU74qPRPAzchZ9

📣 If you've already given us your feedback, you can still help by spreading the news,
either by sharing the above link or telling people about this on Twitter:

https://twitter.com/sagikazarmark/status/1306904078967074816

Thank you! ❤️

@sagikazarmark
Copy link
Collaborator Author

Fixed in #1429

@sagikazarmark sagikazarmark deleted the bind-struct branch December 6, 2023 11:44
@tomqwpl
Copy link

tomqwpl commented Mar 29, 2024

Whilst this appears to have fixed things for "Unmarshal", it doesn't appear to have fixed things for "Unmarshalkey". Naively I expect that Unmarshalkey to be consistent with Unmarshal. That is, the following test fails (added as part of TestUnmarshalWithAutomaticEnv:

        t.Run("Subkey", func(t *testing.T) {
            var config StorageConfig

		if err := v.UnmarshalKey("filesystem", &config); err != nil {
			t.Fatalf("unable to decode into struct, %v", err)
		}

		assert.Equal(
			t,
			StorageConfig{
				Size: 4096,
			},
			config,
		)
	})

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment