8000 Reflection on slice kind ignores tags for field name · Issue #149 · cristalhq/aconfig · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content
Reflection on slice kind ignores tags for field name #149
Open
@semihbkgr

Description

@semihbkgr

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0