Pārlūkot izejas kodu

Fix registry race caused by copying a sync.Mutex

StandardRegistry.MarshalJSON receiver needs to be a pointer to avoid copy.
Jason Toffaletti 11 gadi atpakaļ
vecāks
revīzija
7f86fc7d84
1 mainītis faili ar 1 papildinājumiem un 1 dzēšanām
  1. 1 1
      json.go

+ 1 - 1
json.go

@@ -8,7 +8,7 @@ import (
 
 // MarshalJSON returns a byte slice containing a JSON representation of all
 // the metrics in the Registry.
-func (r StandardRegistry) MarshalJSON() ([]byte, error) {
+func (r *StandardRegistry) MarshalJSON() ([]byte, error) {
 	data := make(map[string]map[string]interface{})
 	r.Each(func(name string, i interface{}) {
 		values := make(map[string]interface{})