mirror of
https://github.com/genuinetools/reg.git
synced 2024-09-28 11:46:20 -04:00
locak on write to map
closes #97 Signed-off-by: Jess Frazelle <acidburn@microsoft.com>
This commit is contained in:
parent
f14de4c039
commit
edc027ac77
1 changed files with 5 additions and 0 deletions
5
list.go
5
list.go
|
@ -36,6 +36,7 @@ var listCommand = cli.Command{
|
|||
fmt.Printf("Repositories for %s\n", r.Domain)
|
||||
|
||||
var (
|
||||
l sync.Mutex
|
||||
wg sync.WaitGroup
|
||||
repoTags = map[string][]string{}
|
||||
)
|
||||
|
@ -50,7 +51,11 @@ var listCommand = cli.Command{
|
|||
}
|
||||
// Sort the tags
|
||||
sort.Strings(tags)
|
||||
|
||||
// Lock on the write to the map.
|
||||
l.Lock()
|
||||
repoTags[repo] = tags
|
||||
l.Unlock()
|
||||
|
||||
wg.Done()
|
||||
}(repo)
|
||||
|
|
Loading…
Reference in a new issue