Skip to content
This repository was archived by the owner on Jan 26, 2023. It is now read-only.

Commit cc844de

Browse files
committed
Don't use zikes/multistatus
1 parent 6183b67 commit cc844de

File tree

1 file changed

+14
-15
lines changed

1 file changed

+14
-15
lines changed

cmd/jules/main.go

Lines changed: 14 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -17,34 +17,36 @@ package main
1717

1818
import (
1919
"bytes"
20-
"context"
2120
"flag"
2221
"fmt"
23-
"github.com/zikes/multistatus"
2422
"log"
2523
"os"
2624
"strings"
2725
"sync"
2826
)
2927

28+
var PrintFormat = "%-32s | %s"
29+
3030
func init() {
3131
log.SetOutput(os.Stdout)
3232
}
3333

3434
func run(stage string, projects []string, conf *Config, args *Arguments) error {
35-
workerSet := multistatus.New()
36-
errors := map[string]error{}
35+
wg := &sync.WaitGroup{}
3736
mutex := &sync.Mutex{}
37+
38+
errors := map[string]error{}
3839
for _, p := range projects {
39-
worker := workerSet.Add(fmt.Sprintf("Project: %s", p))
40-
go func(w *multistatus.Worker, project string) {
40+
wg.Add(1)
41+
go func(project string) {
42+
defer wg.Done()
4143
cmd, err := GetCommand(stage, project, conf)
4244

45+
log.Println(PrintFormat, project, fmt.Sprintf("Running stage '%s'", stage))
4346
if err != nil {
4447
mutex.Lock()
4548
errors[project] = err
4649
mutex.Unlock()
47-
w.Fail()
4850
return
4951
}
5052

@@ -55,24 +57,21 @@ func run(stage string, projects []string, conf *Config, args *Arguments) error {
5557
mutex.Lock()
5658
errors[project] = err
5759
mutex.Unlock()
58-
w.Fail()
5960
log.Println(buff.String())
6061
return
6162
}
62-
63-
w.Done()
64-
}(worker, p)
63+
log.Println(PrintFormat, buff.String())
64+
}(p)
6565
}
66-
// Print the WorkerSet's status until all Workers have completed
67-
workerSet.Print(context.Background())
68-
mutex.Lock()
66+
67+
wg.Wait()
68+
6969
if len(errors) != 0 {
7070
for project, err := range errors {
7171
log.Printf("Error with project %s:\n%s", project, err.Error())
7272
}
7373
os.Exit(1)
7474
}
75-
mutex.Unlock()
7675
return nil
7776
}
7877

0 commit comments

Comments
 (0)