@@ -36,7 +36,7 @@ func PreCommit(c *context.Context) error {
3636 if result .commandError != nil {
3737 hasErrors = true
3838
39- fmt .Printf ("%v:\n " , result .executablePath )
39+ fmt .Printf ("%v:\n " , result .executable . Name )
4040
4141 output := strings .TrimSpace (result .combinedOutput )
4242 for _ , line := range strings .Split (output , "\n " ) {
@@ -53,18 +53,18 @@ func PreCommit(c *context.Context) error {
5353}
5454
5555type Result struct {
56- executablePath string
56+ executable * context. Executable
5757 commandError error
5858 combinedOutput string
5959}
6060
6161// Uses a pool sized to the number of CPUs to run all the executables. It's
6262// sized to the CPU count so that we fully utilized the hardwire but don't
6363// context switch in the OS too much.
64- func runExecutablesInParallel (executables []string , files []string ) ([]* Result ) {
64+ func runExecutablesInParallel (executables []* context. Executable , files []string ) ([]* Result ) {
6565 bufferSize := len (executables )
6666
67- in := make (chan string , bufferSize )
67+ in := make (chan * context. Executable , bufferSize )
6868 out := make (chan * Result , bufferSize )
6969
7070 pool , err := tunny .CreatePoolGeneric (runtime .NumCPU ()).Open ()
@@ -95,14 +95,14 @@ func runExecutablesInParallel(executables []string, files[]string) ([]*Result) {
9595 return results
9696}
9797
98- func runExecutable (path string , files []string ) * Result {
99- cmd := exec .Command (path )
98+ func runExecutable (executable * context. Executable , files []string ) * Result {
99+ cmd := exec .Command (executable . AbsolutePath )
100100 cmd .Stdin = strings .NewReader (strings .Join (files , "\n " ))
101101
102102 combinedOutputBytes , exitError := cmd .CombinedOutput ()
103103
104104 return & Result {
105- executablePath : path ,
105+ executable : executable ,
106106 commandError : exitError ,
107107 combinedOutput : string (combinedOutputBytes ),
108108 }
0 commit comments