]> Cypherpunks repositories - gostls13.git/commitdiff
net: document *OpError.Err must not be nil
authorYasser Abdolmaleki <yasser@yasser.ca>
Fri, 26 Jul 2019 03:44:06 +0000 (20:44 -0700)
committerRob Pike <r@golang.org>
Sun, 19 Jan 2020 02:25:54 +0000 (02:25 +0000)
The point of *net.OpError is to add details to an underlying lower
level error. It makes no sense to have an OpError without an Err and
a nil *OpError.Err will cause *OpError.Error() method to panic.

Fixes #33007

Change-Id: If4fb2501e02dad110a095b73e18c47312ffa6015
Reviewed-on: https://go-review.googlesource.com/c/go/+/187677
Reviewed-by: Rob Pike <r@golang.org>
src/net/net.go

index 38c6b9963747a5bb81293252d11b70643824a542..1d7e5e7f65253198a2400064cc76ac0597316236 100644 (file)
@@ -452,6 +452,7 @@ type OpError struct {
        Addr Addr
 
        // Err is the error that occurred during the operation.
+       // The Error method panics if the error is nil.
        Err error
 }