koanf icon indicating copy to clipboard operation
koanf copied to clipboard

fix: pass event to callback instead of nil when file changes detected

Open josepdcs opened this issue 2 months ago • 3 comments

This pull request makes a targeted fix to the file watching logic in the providers/file/file.go file. The change ensures that the callback function receives the actual file system event object rather than nil, which allows consumers of the API to have more context about the event that triggered the callback.

File watching improvement:

  • Modified the Watch method in File to pass the actual event object to the callback instead of nil, providing more context to callback consumers.

josepdcs avatar Oct 27 '25 19:10 josepdcs

Looks good @josepdcs. Once you've test and confirm, we can merge.

knadh avatar Oct 28 '25 06:10 knadh

Hi @knadh I confirm that it works, and I’ve also modified the TestWatchFile test by adding an assertion to verify that the event is present and not nil.

josepdcs avatar Oct 28 '25 07:10 josepdcs

LGTM :+1:

rhnvrm avatar Oct 30 '25 06:10 rhnvrm