1
0
mirror of https://github.com/SAP/jenkins-library.git synced 2024-12-12 10:55:20 +02:00

generator: Don't swallow output from go fmt (#2222)

* generator: Don't swallow output from go fmt

* fix formatting

Co-authored-by: Oliver Nocon <33484802+OliverNocon@users.noreply.github.com>
This commit is contained in:
Marcus Holl 2020-11-02 10:31:00 +01:00 committed by GitHub
parent ea5e91672d
commit 073a2a8599
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1,6 +1,7 @@
package main
import (
"bufio"
"flag"
"fmt"
"io"
@ -32,6 +33,17 @@ func main() {
fmt.Printf("Running go fmt %v\n", targetDir)
cmd := exec.Command("go", "fmt", targetDir)
r, _ := cmd.StdoutPipe()
cmd.Stderr = cmd.Stdout
done := make(chan struct{})
scanner := bufio.NewScanner(r)
go func() {
for scanner.Scan() {
fmt.Println(scanner.Text())
}
done <- struct{}{}
}()
err = cmd.Run()
checkError(err)