mirror of
https://github.com/genuinetools/reg.git
synced 2024-09-28 11:46:20 -04:00
make ls faster (#48)
This commit is contained in:
parent
75dcff4501
commit
29f6d2fab9
1 changed files with 13 additions and 7 deletions
10
main.go
10
main.go
|
@ -7,6 +7,7 @@ import (
|
|||
"io/ioutil"
|
||||
"os"
|
||||
"strings"
|
||||
"sync"
|
||||
"text/tabwriter"
|
||||
|
||||
"github.com/Sirupsen/logrus"
|
||||
|
@ -138,15 +139,20 @@ func main() {
|
|||
// print header
|
||||
fmt.Fprintln(w, "REPO\tTAGS")
|
||||
|
||||
var wg sync.WaitGroup
|
||||
wg.Add(len(repos))
|
||||
for _, repo := range repos {
|
||||
go func(repo string) {
|
||||
// get the tags and print to stdout
|
||||
tags, err := r.Tags(repo)
|
||||
if err != nil {
|
||||
return err
|
||||
fmt.Printf("Get tags of [%s] error: %s", repo, err)
|
||||
}
|
||||
|
||||
fmt.Fprintf(w, "%s\t%s\n", repo, strings.Join(tags, ", "))
|
||||
wg.Done()
|
||||
}(repo)
|
||||
}
|
||||
wg.Wait()
|
||||
|
||||
w.Flush()
|
||||
return nil
|
||||
|
|
Loading…
Reference in a new issue