explain code per review comments

This commit is contained in:
Tom Hayward 2024-04-19 07:40:51 -07:00
parent c826eebbbb
commit 4a1e3c4200

View file

@ -202,6 +202,8 @@ func NewNGINXController(config *Configuration, mc metric.Collector) *NGINXContro
}
for _, f := range filesToWatch {
// This redeclaration is necessary for the closure to get the correct value for the iteration in go versions <1.22
// See https://go.dev/blog/loopvar-preview
f := f
_, err = file.NewFileWatcher(f, func() {
klog.InfoS("File change detected. Reloading NGINX", "path", f)