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:
parent
ea5e91672d
commit
073a2a8599
@ -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)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user