fix: do not strip whitespace when displaying a file for debugging purposes

This commit is contained in:
Jose Diaz-Gonzalez
2024-01-18 19:13:44 -05:00
parent 3f96a250a2
commit 8cc822eed0

View File

@@ -12,14 +12,15 @@ import (
// CatFile cats the contents of a file (if it exists) // CatFile cats the contents of a file (if it exists)
func CatFile(filename string) { func CatFile(filename string) {
slice, err := FileToSlice(filename) f, err := os.Open(filename)
if err != nil { if err != nil {
LogDebug(fmt.Sprintf("Error cat'ing file %s: %s", filename, err.Error()))
return return
} }
defer f.Close()
for _, line := range slice { scanner := bufio.NewScanner(f)
LogDebug(fmt.Sprintf("line: '%s'", line)) for scanner.Scan() {
LogDebug(fmt.Sprintf("line: '%s'", scanner.Text()))
} }
} }