From 1cf978aa01776cbbc6c290d57e9f7b11ddc63592 Mon Sep 17 00:00:00 2001 From: Tyler Lloyd Date: Wed, 6 Dec 2023 08:37:35 -0500 Subject: [PATCH] fix: use `MkdirAll` in fsnotify On Windows, the path /var/run/azure-vnet does not exist so calling `Mkdir('/var/run/azure-vnet/deleteIDs'` will fail because the parent folder doesn't exist. Switch to MkdirAll so it creates any necessary parent folders. --- cns/fsnotify/fsnotify.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cns/fsnotify/fsnotify.go b/cns/fsnotify/fsnotify.go index 5f1beaf1b1..c88e6c0662 100644 --- a/cns/fsnotify/fsnotify.go +++ b/cns/fsnotify/fsnotify.go @@ -29,7 +29,7 @@ type watcher struct { // Create the AsyncDelete watcher. func New(cli releaseIPsClient, path string, logger *zap.Logger) *watcher { //nolint // Add directory where intended deletes are kept - if err := os.Mkdir(path, 0o755); err != nil { //nolint + if err := os.MkdirAll(path, 0o755); err != nil { //nolint logger.Error("error making directory", zap.String("path", path), zap.Error(err)) } return &watcher{