mirror of
https://github.com/golang/go
synced 2024-11-17 05:54:46 -07:00
Use conventional err
in example
It is conventional to use `err` for error variables, so change the example to use `err` instead of `e`. Also fix a corresponding occurrence in the corresponding test file.
This commit is contained in:
parent
d983be9cb5
commit
3e2ed84eef
@ -86,9 +86,9 @@ The server calls (for HTTP service):
|
|||||||
arith := new(Arith)
|
arith := new(Arith)
|
||||||
rpc.Register(arith)
|
rpc.Register(arith)
|
||||||
rpc.HandleHTTP()
|
rpc.HandleHTTP()
|
||||||
l, e := net.Listen("tcp", ":1234")
|
l, err := net.Listen("tcp", ":1234")
|
||||||
if e != nil {
|
if err != nil {
|
||||||
log.Fatal("listen error:", e)
|
log.Fatal("listen error:", err)
|
||||||
}
|
}
|
||||||
go http.Serve(l, nil)
|
go http.Serve(l, nil)
|
||||||
|
|
||||||
|
@ -110,9 +110,9 @@ func (BuiltinTypes) Array(args *Args, reply *[2]int) error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func listenTCP() (net.Listener, string) {
|
func listenTCP() (net.Listener, string) {
|
||||||
l, e := net.Listen("tcp", "127.0.0.1:0") // any available address
|
l, err := net.Listen("tcp", "127.0.0.1:0") // any available address
|
||||||
if e != nil {
|
if err != nil {
|
||||||
log.Fatalf("net.Listen tcp :0: %v", e)
|
log.Fatalf("net.Listen tcp :0: %v", err)
|
||||||
}
|
}
|
||||||
return l, l.Addr().String()
|
return l, l.Addr().String()
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user