]> git.ipfire.org Git - thirdparty/wireguard-go.git/commitdiff
device: avoid copying lock in tests
authorJosh Bleecher Snyder <josh@tailscale.com>
Sat, 5 Dec 2020 00:05:51 +0000 (16:05 -0800)
committerJosh Bleecher Snyder <josh@tailscale.com>
Tue, 8 Dec 2020 22:25:10 +0000 (14:25 -0800)
This doesn't cause any practical problems as it is,
but vet (rightly) flags this code as copying a mutex.
It is easy to fix, so do so.

Signed-off-by: Josh Bleecher Snyder <josh@tailscale.com>
device/peer_test.go

index 6aa238b2e658a3d0193bfa18ba3d8e2aa67cf084..9c1ede5f46b556fe16990ad9542542d4550754d0 100644 (file)
@@ -26,7 +26,7 @@ func checkAlignment(t *testing.T, name string, offset uintptr) {
 func TestPeerAlignment(t *testing.T) {
        var p Peer
 
-       typ := reflect.TypeOf(p)
+       typ := reflect.TypeOf(&p).Elem()
        t.Logf("Peer type size: %d, with fields:", typ.Size())
        for i := 0; i < typ.NumField(); i++ {
                field := typ.Field(i)