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())) } }