]> Cypherpunks repositories - gostls13.git/commitdiff
sync: hide test of misuse of Cond from vet
authorRuss Cox <rsc@golang.org>
Fri, 20 Apr 2018 15:37:34 +0000 (11:37 -0400)
committerRuss Cox <rsc@golang.org>
Wed, 25 Apr 2018 02:49:46 +0000 (02:49 +0000)
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>
src/sync/cond_test.go

index 9019f8f102827ff57636acbee43a41f5209dce9a..9d0d9adc7486ddbef338d1e4a9a17425f1b90493 100644 (file)
@@ -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()
 }