From cbaa666682386fe5350bf87d7d70171704c90fe4 Mon Sep 17 00:00:00 2001 From: Yasser Abdolmaleki Date: Thu, 25 Jul 2019 20:44:06 -0700 Subject: [PATCH] net: document *OpError.Err must not be nil 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 --- src/net/net.go | 1 + 1 file changed, 1 insertion(+) diff --git a/src/net/net.go b/src/net/net.go index 38c6b99637..1d7e5e7f65 100644 --- a/src/net/net.go +++ b/src/net/net.go @@ -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 } -- 2.50.0