mirror of
https://github.com/golang/go
synced 2024-11-23 06:30:06 -07:00
sync: hide test of misuse of Cond from vet
The test wants to check that copies of Cond are detected at runtime. Make a copy that isn't detected by vet at compile time. Change-Id: I933ab1003585f75ba96723563107f1ba8126cb72 Reviewed-on: https://go-review.googlesource.com/108557 Reviewed-by: Ian Lance Taylor <iant@golang.org>
This commit is contained in:
parent
09d36a819e
commit
eca7a1343c
@ -4,9 +4,9 @@
|
||||
package sync_test
|
||||
|
||||
import (
|
||||
. "sync"
|
||||
|
||||
"reflect"
|
||||
"runtime"
|
||||
. "sync"
|
||||
"testing"
|
||||
"time"
|
||||
)
|
||||
@ -251,7 +251,8 @@ func TestCondCopy(t *testing.T) {
|
||||
}()
|
||||
c := Cond{L: &Mutex{}}
|
||||
c.Signal()
|
||||
c2 := c
|
||||
var c2 Cond
|
||||
reflect.ValueOf(&c2).Elem().Set(reflect.ValueOf(&c).Elem()) // c2 := c, hidden from vet
|
||||
c2.Signal()
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user