locak on write to map

closes #97

Signed-off-by: Jess Frazelle <acidburn@microsoft.com>
This commit is contained in:
Jess Frazelle 2018-06-18 09:53:30 -04:00
parent f14de4c039
commit edc027ac77
No known key found for this signature in database
GPG key ID: 18F3685C0022BFF3

View file

@ -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)