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

Reflection on slice kind ignores tags for field name #149

Open
semihbkgr opened this issue Dec 23, 2023 · 0 comments
Open

Reflection on slice kind ignores tags for field name #149

semihbkgr opened this issue Dec 23, 2023 · 0 comments
Labels
bug Something isn't working

Comments

@semihbkgr
Copy link

The reflection process does not consider struct field tags within a slice. Therefore, the field name must match the tag name, starting with an uppercase letter.

func (l *Loader) m2s(m map[string]interface{}, structValue reflect.Value) error {
	for name, value := range m {
		name = strings.Title(name)
		structFieldValue := structValue.FieldByName(name)
                ...

https://github.com/cristalhq/aconfig/blob/main/reflection.go#L351

It appears that this issue is main reason of #147

@cristaloleg cristaloleg added the bug Something isn't working label Dec 26, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants