Fix more race conditions found by race detector

This commit is contained in:
Eugene Bujak
2018-10-07 21:24:22 +03:00
parent dc1042c3e9
commit 3b1faa1365
2 changed files with 23 additions and 19 deletions

View File

@@ -254,7 +254,7 @@ func writeStats() error {
statsFile := filepath.Join(config.ourBinaryDir, "stats.json")
log.Printf("Writing JSON file: %s", statsFile)
statistics.RLock()
json, err := json.MarshalIndent(statistics, "", " ")
json, err := json.MarshalIndent(&statistics, "", " ")
statistics.RUnlock()
if err != nil {
log.Printf("Couldn't generate JSON: %s", err)