diff --git a/src/syscall/creds_test.go b/src/syscall/creds_test.go index b1894c66b0..b4a14ff4dd 100644 --- a/src/syscall/creds_test.go +++ b/src/syscall/creds_test.go @@ -56,7 +56,13 @@ func TestSCMCredentials(t *testing.T) { ucred.Gid = 0 oob := syscall.UnixCredentials(&ucred) _, _, err := cli.(*net.UnixConn).WriteMsgUnix(nil, oob, nil) - if err.(*net.OpError).Err != syscall.EPERM { + if op, ok := err.(*net.OpError); ok { + err = op.Err + } + if sys, ok := err.(*os.SyscallError); ok { + err = sys.Err + } + if err != syscall.EPERM { t.Fatalf("WriteMsgUnix failed with %v, want EPERM", err) } }