Skip to content

Commit

Permalink
rm-double-loop
Browse files Browse the repository at this point in the history
Signed-off-by: Juliette Pretot <julsh@google.com>
  • Loading branch information
jul-sh committed Apr 15, 2024
1 parent 55835eb commit 96f43e0
Showing 1 changed file with 16 additions and 19 deletions.
35 changes: 16 additions & 19 deletions internal/builders/docker/pkg/builder.go
Original file line number Diff line number Diff line change
Expand Up @@ -482,30 +482,27 @@ func saveToTempFile(verbose bool, readers ...io.Reader) ([]string, error) {
var files []string
for _, reader := range readers {
var allBytes []byte
if verbose {
fmt.Print("\n\n>>>>>>>>>>>>>> output from command <<<<<<<<<<<<<<\n")
}

for _, reader := range readers {
if verbose {
fmt.Print("\n\n>>>>>>>>>>>>>> output from command <<<<<<<<<<<<<<\n")
}

scanner := bufio.NewScanner(reader)
for scanner.Scan() {
bytes := scanner.Bytes()
allBytes = append(allBytes, bytes...)
allBytes = append(allBytes, '\n')

if verbose {
fmt.Printf("%s\n", bytes)
}
}
scanner := bufio.NewScanner(reader)
for scanner.Scan() {
bytes := scanner.Bytes()
allBytes = append(allBytes, bytes...)
allBytes = append(allBytes, '\n')

if verbose {
fmt.Print("=================================================\n\n\n")
fmt.Printf("%s\n", bytes)
}
}

if err := scanner.Err(); err != nil {
return files, fmt.Errorf("error reading from command output: %v", err)
}
if verbose {
fmt.Print("=================================================\n\n\n")
}

if err := scanner.Err(); err != nil {
return files, fmt.Errorf("error reading from command output: %v", err)
}

tmpfile, err := os.CreateTemp("", "log-*.txt")
Expand Down

0 comments on commit 96f43e0

Please sign in to comment.