From d593c83603ead2321b1bab885a7d00e1b2a7cc4d Mon Sep 17 00:00:00 2001 From: Manuel Buil Date: Mon, 3 Jul 2023 16:08:39 +0200 Subject: [PATCH] Remove file_windows.go Signed-off-by: Manuel Buil --- pkg/util/file.go | 2 -- pkg/util/file_windows.go | 39 --------------------------------------- 2 files changed, 41 deletions(-) delete mode 100644 pkg/util/file_windows.go diff --git a/pkg/util/file.go b/pkg/util/file.go index 2d44ee94e8..3b43c32843 100644 --- a/pkg/util/file.go +++ b/pkg/util/file.go @@ -1,5 +1,3 @@ -//go:build !windows - package util import ( diff --git a/pkg/util/file_windows.go b/pkg/util/file_windows.go deleted file mode 100644 index c6f7601393..0000000000 --- a/pkg/util/file_windows.go +++ /dev/null @@ -1,39 +0,0 @@ -package util - -import ( - "os" - "strings" - "time" - - "github.com/pkg/errors" - "github.com/sirupsen/logrus" -) - -func SetFileModeForPath(name string, mode os.FileMode) error { - return nil -} - -func SetFileModeForFile(file *os.File, mode os.FileMode) error { - return nil -} - -// ReadFile reads from a file -func ReadFile(path string) (string, error) { - if path == "" { - return "", nil - } - - for start := time.Now(); time.Since(start) < 4*time.Minute; { - vpnBytes, err := os.ReadFile(path) - if err == nil { - return strings.TrimSpace(string(vpnBytes)), nil - } else if os.IsNotExist(err) { - logrus.Infof("Waiting for %s to be available\n", path) - time.Sleep(2 * time.Second) - } else { - return "", err - } - } - - return "", errors.New("Timeout while trying to read the file") -} \ No newline at end of file