Skip to content

v2.3.0 introduced mutex locks and my custom merge function stuck #383

@BananZG

Description

@BananZG

Describe the bug
After upgrading to v2.3.0, I noticed that there's new mutex lock added to all the main functions.
I wanted to make sure that in my project, all keys are case insensitive (as i moved from Viper hehe), I make sure all keys are lowercased.

In the custom merge function, i've added k.GetString("env") to get the environment variable so that I can have diff log level on the merge outcome.
This has caused the library to hit ko.mu.RLock() and stuck.
Image
Technically I can just remove this, but would be bad in case anything goes wrong.
Any suggestion please?
Or is there any built in way to make all keys lowercased?

To Reproduce
Use custom merge function and try to read and value from k eg: k.String("") in it.

Expected behavior
A clear and concise description of what you expected to happen.
Before introduction of mutex locks it was okay.

Please provide the following information):

  • OS: oxs
  • Koanf Version v2.3.0

Additional context

  • The "ENV" is always available and loaded first from environment.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions