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

YAML tag in struct not being respected for unmarshalling #7

Open
lucaslopezf opened this issue Aug 16, 2023 · 0 comments
Open

YAML tag in struct not being respected for unmarshalling #7

lucaslopezf opened this issue Aug 16, 2023 · 0 comments

Comments

@lucaslopezf
Copy link
Contributor

lucaslopezf commented Aug 16, 2023

Description

When attempting to unmarshal a YAML configuration using the Config structure, the TestConfig field doesn't correctly map to the test_config key in the YAML. Instead, it seems to be defaulting to the struct field name (TestConfig).

Config struct

type Config struct {
	TestConfig TestConfig `yaml:"test_config"`
}

Expected Behavior

The TestConfig field should map to the test_config key in the YAML.

Actual Behavior:

The TestConfig field maps to the TestConfig key in the YAML.

Steps to Reproduce:

  • Create a YAML file with the key test_config and some nested values.
  • Attempt to unmarshal this YAML into the Config struct.
  • Observe that the TestConfig field does not populate with the values from the test_config key in the YAML.

🔗 zboto Link

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

No branches or pull requests

1 participant