Skip to content

Commit 28ca813

Browse files
darkfelinegopherbot
authored andcommitted
net/rpc: use conventional err in example
It is conventional to use `err` for error variables, so change the example to use `err` instead of `e`. Change-Id: I53bc3c5384fe608b322a55c564e9aee228b43329 GitHub-Last-Rev: 3e2ed84 GitHub-Pull-Request: #61375 Reviewed-on: https://go-review.googlesource.com/c/go/+/510075 Reviewed-by: Rob Pike <[email protected]> Run-TryBot: Ian Lance Taylor <[email protected]> Run-TryBot: Rob Pike <[email protected]> Reviewed-by: Allen Li <[email protected]> Reviewed-by: Ian Lance Taylor <[email protected]> TryBot-Result: Gopher Robot <[email protected]> Auto-Submit: Ian Lance Taylor <[email protected]>
1 parent d983be9 commit 28ca813

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

src/net/rpc/server.go

+3-3
Original file line numberDiff line numberDiff line change
@@ -86,9 +86,9 @@ The server calls (for HTTP service):
8686
arith := new(Arith)
8787
rpc.Register(arith)
8888
rpc.HandleHTTP()
89-
l, e := net.Listen("tcp", ":1234")
90-
if e != nil {
91-
log.Fatal("listen error:", e)
89+
l, err := net.Listen("tcp", ":1234")
90+
if err != nil {
91+
log.Fatal("listen error:", err)
9292
}
9393
go http.Serve(l, nil)
9494

src/net/rpc/server_test.go

+3-3
Original file line numberDiff line numberDiff line change
@@ -110,9 +110,9 @@ func (BuiltinTypes) Array(args *Args, reply *[2]int) error {
110110
}
111111

112112
func listenTCP() (net.Listener, string) {
113-
l, e := net.Listen("tcp", "127.0.0.1:0") // any available address
114-
if e != nil {
115-
log.Fatalf("net.Listen tcp :0: %v", e)
113+
l, err := net.Listen("tcp", "127.0.0.1:0") // any available address
114+
if err != nil {
115+
log.Fatalf("net.Listen tcp :0: %v", err)
116116
}
117117
return l, l.Addr().String()
118118
}

0 commit comments

Comments
 (0)