all: Make all error implementations pointer types (#6726)

This matches the convention of the stdlib and avoids ambiguity: when
customErr{} and &customErr{} both implement error, client code needs to
check for both.

Memory use should remain the same, since storing a non-pointer type in
an interface value still copies the value to the heap.
This commit is contained in:
greatroar
2020-06-16 09:27:34 +02:00
committed by GitHub
parent a47546a1f1
commit df83b84aa1
12 changed files with 36 additions and 48 deletions
+1 -1
View File
@@ -201,7 +201,7 @@ func (c *staticClient) join() error {
switch msg := message.(type) {
case protocol.Response:
if msg.Code != 0 {
return incorrectResponseCodeErr{msg.Code, msg.Message}
return &incorrectResponseCodeErr{msg.Code, msg.Message}
}
case protocol.RelayFull: