From edc027ac77887b9c317d947936cef0137abf567d Mon Sep 17 00:00:00 2001 From: Jess Frazelle Date: Mon, 18 Jun 2018 09:53:30 -0400 Subject: [PATCH] locak on write to map closes #97 Signed-off-by: Jess Frazelle --- list.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/list.go b/list.go index 178f316a..4c9c944b 100644 --- a/list.go +++ b/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)