From 8cc822eed0fd4e4f58d9b65904a023503fe2c866 Mon Sep 17 00:00:00 2001 From: Jose Diaz-Gonzalez Date: Thu, 18 Jan 2024 19:13:44 -0500 Subject: [PATCH] fix: do not strip whitespace when displaying a file for debugging purposes --- plugins/common/io.go | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/plugins/common/io.go b/plugins/common/io.go index 1c5aa8a39..a5bf19e45 100644 --- a/plugins/common/io.go +++ b/plugins/common/io.go @@ -12,14 +12,15 @@ import ( // CatFile cats the contents of a file (if it exists) func CatFile(filename string) { - slice, err := FileToSlice(filename) + f, err := os.Open(filename) if err != nil { - LogDebug(fmt.Sprintf("Error cat'ing file %s: %s", filename, err.Error())) return } + defer f.Close() - for _, line := range slice { - LogDebug(fmt.Sprintf("line: '%s'", line)) + scanner := bufio.NewScanner(f) + for scanner.Scan() { + LogDebug(fmt.Sprintf("line: '%s'", scanner.Text())) } }