explain code per review comments
This commit is contained in:
parent
c826eebbbb
commit
4a1e3c4200
1 changed files with 2 additions and 0 deletions
|
@ -202,6 +202,8 @@ func NewNGINXController(config *Configuration, mc metric.Collector) *NGINXContro
|
||||||
}
|
}
|
||||||
|
|
||||||
for _, f := range filesToWatch {
|
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
|
f := f
|
||||||
_, err = file.NewFileWatcher(f, func() {
|
_, err = file.NewFileWatcher(f, func() {
|
||||||
klog.InfoS("File change detected. Reloading NGINX", "path", f)
|
klog.InfoS("File change detected. Reloading NGINX", "path", f)
|
||||||
|
|
Loading…
Reference in a new issue