net: simplify error return in *RawConn test helpers
No need to check operr before returning.
Change-Id: I64b849f7c102de01180823e3f0123d438ce7608a
Reviewed-on: https://go-review.googlesource.com/c/go/+/232797
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
diff --git a/src/net/rawconn_unix_test.go b/src/net/rawconn_unix_test.go
index a71b6f3..0194ba6 100644
--- a/src/net/rawconn_unix_test.go
+++ b/src/net/rawconn_unix_test.go
@@ -24,10 +24,7 @@
if err != nil {
return n, err
}
- if operr != nil {
- return n, operr
- }
- return n, nil
+ return n, operr
}
func writeRawConn(c syscall.RawConn, b []byte) error {
@@ -42,10 +39,7 @@
if err != nil {
return err
}
- if operr != nil {
- return operr
- }
- return nil
+ return operr
}
func controlRawConn(c syscall.RawConn, addr Addr) error {
@@ -87,10 +81,7 @@
if err := c.Control(fn); err != nil {
return err
}
- if operr != nil {
- return operr
- }
- return nil
+ return operr
}
func controlOnConnSetup(network string, address string, c syscall.RawConn) error {
@@ -120,8 +111,5 @@
if err := c.Control(fn); err != nil {
return err
}
- if operr != nil {
- return operr
- }
- return nil
+ return operr
}
diff --git a/src/net/rawconn_windows_test.go b/src/net/rawconn_windows_test.go
index 2774c97..5febf08 100644
--- a/src/net/rawconn_windows_test.go
+++ b/src/net/rawconn_windows_test.go
@@ -26,10 +26,7 @@
if err != nil {
return n, err
}
- if operr != nil {
- return n, operr
- }
- return n, nil
+ return n, operr
}
func writeRawConn(c syscall.RawConn, b []byte) error {
@@ -45,10 +42,7 @@
if err != nil {
return err
}
- if operr != nil {
- return operr
- }
- return nil
+ return operr
}
func controlRawConn(c syscall.RawConn, addr Addr) error {
@@ -92,10 +86,7 @@
if err := c.Control(fn); err != nil {
return err
}
- if operr != nil {
- return operr
- }
- return nil
+ return operr
}
func controlOnConnSetup(network string, address string, c syscall.RawConn) error {
@@ -121,8 +112,5 @@
if err := c.Control(fn); err != nil {
return err
}
- if operr != nil {
- return operr
- }
- return nil
+ return operr
}