Skip to content

Commit 7a3380b

Browse files
author
Marek
committed
fix: Synchronize goroutines accessing shared var
1 parent f5fd87f commit 7a3380b

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

main/main.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ import (
1414

1515
var configPath string
1616
var removed int = 0
17+
var mutex = &sync.Mutex{}
1718

1819
func main() {
1920
parseCmdFlags()
@@ -47,6 +48,8 @@ func deleteIssueReactions(wg *sync.WaitGroup, client *github.Client, cfg *Config
4748
if err != nil {
4849
fmt.Fprintf(os.Stderr, "[WARN] Could not delete reaction %v\nerror:\n%v", reaction, err)
4950
} else {
51+
mutex.Lock()
52+
defer mutex.Unlock()
5053
removed++
5154
}
5255
}

0 commit comments

Comments
 (0)