[main] show only files that don't match gofmt
This commit is contained in:
parent
95c94fab43
commit
b47aa0d903
|
@ -2,8 +2,8 @@ package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"log"
|
|
||||||
"os"
|
"os"
|
||||||
|
"strings"
|
||||||
|
|
||||||
"github.com/mthie/git-gohooks/general"
|
"github.com/mthie/git-gohooks/general"
|
||||||
)
|
)
|
||||||
|
@ -23,13 +23,15 @@ func main() {
|
||||||
os.Exit(0)
|
os.Exit(0)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
resultFiles := strings.Split(result, "\n")
|
||||||
|
|
||||||
fmt.Fprint(os.Stderr, "Go files must be formatted with gofmt. Please run:\n\n")
|
fmt.Fprint(os.Stderr, "Go files must be formatted with gofmt. Please run:\n\n")
|
||||||
fmt.Fprint(os.Stderr, " gofmt -w")
|
fmt.Fprint(os.Stderr, " gofmt -w")
|
||||||
for _, file := range files {
|
for _, file := range resultFiles {
|
||||||
fmt.Fprint(os.Stderr, " \\\n")
|
fmt.Fprint(os.Stderr, " \\\n")
|
||||||
fmt.Fprintf(os.Stderr, " %s", file)
|
fmt.Fprintf(os.Stderr, " %s", file)
|
||||||
}
|
}
|
||||||
fmt.Fprint(os.Stderr, "\n")
|
fmt.Fprint(os.Stderr, "\n")
|
||||||
os.Exit(1)
|
os.Exit(1)
|
||||||
log.Printf("Result: %+v", result)
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user