From 3dec8fc77cf0b9e8ecfbc701285a63360b05b71c Mon Sep 17 00:00:00 2001 From: Ian Lance Taylor Date: Mon, 11 May 2015 20:05:38 -0700 Subject: [PATCH] unix: fix TestSCMCredentials Port http://golang.org/cl/9714 from the main syscall package. Change-Id: I85e3f119777b0e1f52dfd10365fd30c900120dc2 Reviewed-on: https://go-review.googlesource.com/9961 Reviewed-by: Minux Ma --- unix/creds_test.go | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/unix/creds_test.go b/unix/creds_test.go index 30694a0f..eaae7c36 100644 --- a/unix/creds_test.go +++ b/unix/creds_test.go @@ -58,7 +58,13 @@ func TestSCMCredentials(t *testing.T) { ucred.Gid = 0 oob := unix.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) } }