We're doing object copy on String call, but it makes race detector
angry: copy of sync.Once and changing its state at the same time. Also,
it fixes three vet warnings about passing lock by value.

Signed-off-by: Alexander Morozov <lk4d4math@gmail.com>
This commit is contained in:
Alexander Morozov 2016-08-29 10:22:11 -07:00
Родитель 18b43f1bc8
Коммит 834ad85c70
3 изменённых файлов: 3 добавлений и 3 удалений

Просмотреть файл

@ -160,7 +160,7 @@ func (b *Broadcaster) run() {
}
}
func (b Broadcaster) String() string {
func (b *Broadcaster) String() string {
// Serialize copy of this broadcaster without the sync.Once, to avoid
// a data race.

Просмотреть файл

@ -50,7 +50,7 @@ func (ch *Channel) Close() error {
return nil
}
func (ch Channel) String() string {
func (ch *Channel) String() string {
// Serialize a copy of the Channel that doesn't contain the sync.Once,
// to avoid a data race.
ch2 := map[string]interface{}{

Просмотреть файл

@ -90,7 +90,7 @@ func (rs *RetryingSink) Close() error {
return nil
}
func (rs RetryingSink) String() string {
func (rs *RetryingSink) String() string {
// Serialize a copy of the RetryingSink without the sync.Once, to avoid
// a data race.
rs2 := map[string]interface{}{