mirror of
https://github.com/genuinetools/reg.git
synced 2024-09-28 11:46:20 -04:00
Locking around ls writes to tabwriter (#55)
Fixes #54 Signed-off-by: Matt Vinall <boyvinall@gmail.com>
This commit is contained in:
parent
cde5e3cc1f
commit
22cbb0f2a0
1 changed files with 3 additions and 0 deletions
3
main.go
3
main.go
|
@ -140,6 +140,7 @@ func main() {
|
|||
// print header
|
||||
fmt.Fprintln(w, "REPO\tTAGS")
|
||||
|
||||
var l sync.Mutex
|
||||
var wg sync.WaitGroup
|
||||
wg.Add(len(repos))
|
||||
for _, repo := range repos {
|
||||
|
@ -150,7 +151,9 @@ func main() {
|
|||
fmt.Printf("Get tags of [%s] error: %s", repo, err)
|
||||
}
|
||||
out := fmt.Sprintf("%s\t%s\n", repo, strings.Join(tags, ", "))
|
||||
l.Lock()
|
||||
w.Write([]byte(out))
|
||||
l.Unlock()
|
||||
wg.Done()
|
||||
}(repo)
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue