Merge pull request #6445 from dokku/cat-file-exact

Do not strip whitespace when displaying a file for debugging purposes
This commit is contained in:
Jose Diaz-Gonzalez
2024-01-18 20:46:06 -05:00
committed by GitHub

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