aconfig icon indicating copy to clipboard operation
aconfig copied to clipboard

Reflection on slice kind ignores tags for field name

Open semihbkgr opened this issue 6 months ago • 0 comments

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

semihbkgr avatar Dec 23 '23 11:12 semihbkgr