aboutsummaryrefslogtreecommitdiff
path: root/src/sync
diff options
context:
space:
mode:
authorRuss Cox <rsc@golang.org>2018-04-20 11:37:34 -0400
committerRuss Cox <rsc@golang.org>2018-04-25 02:49:46 +0000
commiteca7a1343c6d4ac9417784cf5f37419ea05f34d3 (patch)
tree14711f46fdd972207b9f88fa0613d4614b547b3a /src/sync
parent09d36a819eb48d6a2c10b36bf654dcf8867d6641 (diff)
downloadgo-eca7a1343c6d4ac9417784cf5f37419ea05f34d3.tar.gz
go-eca7a1343c6d4ac9417784cf5f37419ea05f34d3.zip
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>
Diffstat (limited to 'src/sync')
-rw-r--r--src/sync/cond_test.go7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/sync/cond_test.go b/src/sync/cond_test.go
index 9019f8f102..9d0d9adc74 100644
--- a/src/sync/cond_test.go
+++ b/src/sync/cond_test.go
@@ -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()
}