Skip to content

Commit

Permalink
net/rpc: use conventional err in example
Browse files Browse the repository at this point in the history
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 <r@golang.org>
Run-TryBot: Ian Lance Taylor <iant@google.com>
Run-TryBot: Rob Pike <r@golang.org>
Reviewed-by: Allen Li <ayatane@google.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Auto-Submit: Ian Lance Taylor <iant@google.com>
  • Loading branch information
darkfeline authored and gopherbot committed Jul 18, 2023
1 parent d983be9 commit 28ca813
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
6 changes: 3 additions & 3 deletions src/net/rpc/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -86,9 +86,9 @@ The server calls (for HTTP service):
arith := new(Arith)
rpc.Register(arith)
rpc.HandleHTTP()
l, e := net.Listen("tcp", ":1234")
if e != nil {
log.Fatal("listen error:", e)
l, err := net.Listen("tcp", ":1234")
if err != nil {
log.Fatal("listen error:", err)
}
go http.Serve(l, nil)
Expand Down
6 changes: 3 additions & 3 deletions src/net/rpc/server_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -110,9 +110,9 @@ func (BuiltinTypes) Array(args *Args, reply *[2]int) error {
}

func listenTCP() (net.Listener, string) {
l, e := net.Listen("tcp", "127.0.0.1:0") // any available address
if e != nil {
log.Fatalf("net.Listen tcp :0: %v", e)
l, err := net.Listen("tcp", "127.0.0.1:0") // any available address
if err != nil {
log.Fatalf("net.Listen tcp :0: %v", err)
}
return l, l.Addr().String()
}
Expand Down

0 comments on commit 28ca813

Please sign in to comment.