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

why gproperties.Decode() let lastKey to lower? #3436

Closed
yiqiang3344 opened this issue Mar 28, 2024 · 0 comments
Closed

why gproperties.Decode() let lastKey to lower? #3436

yiqiang3344 opened this issue Mar 28, 2024 · 0 comments

Comments

@yiqiang3344
Copy link

yiqiang3344 commented Mar 28, 2024

func Decode(data []byte) (res map[string]interface{}, err error) {
	res = make(map[string]interface{})
	pr, err := properties.Load(data, properties.UTF8)
	if err != nil || pr == nil {
		err = gerror.Wrapf(err, `Lib magiconair load Properties data failed.`)
		return nil, err
	}
	for _, key := range pr.Keys() {
		// ignore existence check: we know it's there
		value, _ := pr.Get(key)
		// recursively build nested maps
		path := strings.Split(key, ".")
		lastKey := strings.ToLower(path[len(path)-1])
		deepestMap := deepSearch(res, path[0:len(path)-1])

		// set innermost value
		deepestMap[lastKey] = value
	}
	return res, nil
}

this let gproperties type config can't get right value of camel-case key。

@github-actions github-actions bot closed this as not planned Won't fix, can't repro, duplicate, stale May 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant