Skip to content

Commit

Permalink
gee-rpc: gob.go use err = to replace err :=
Browse files Browse the repository at this point in the history
  • Loading branch information
geektutu committed Oct 6, 2020
1 parent 69d229a commit e094f10
Show file tree
Hide file tree
Showing 7 changed files with 39 additions and 39 deletions.
14 changes: 7 additions & 7 deletions gee-rpc/day1-codec/codec/gob.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,15 +41,15 @@ func (c *GobCodec) Write(h *Header, body interface{}) (err error) {
_ = c.Close()
}
}()
if err := c.enc.Encode(h); err != nil {
log.Println("rpc codec: gob error encoding header:", err)
return err
if err = c.enc.Encode(h); err != nil {
log.Println("rpc: gob error encoding header:", err)
return
}
if err := c.enc.Encode(body); err != nil {
log.Println("rpc codec: gob error encoding body:", err)
return err
if err = c.enc.Encode(body); err != nil {
log.Println("rpc: gob error encoding body:", err)
return
}
return nil
return
}

func (c *GobCodec) Close() error {
Expand Down
14 changes: 7 additions & 7 deletions gee-rpc/day2-client/codec/gob.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,15 +41,15 @@ func (c *GobCodec) Write(h *Header, body interface{}) (err error) {
_ = c.Close()
}
}()
if err := c.enc.Encode(h); err != nil {
log.Println("rpc codec: gob error encoding header:", err)
return err
if err = c.enc.Encode(h); err != nil {
log.Println("rpc: gob error encoding header:", err)
return
}
if err := c.enc.Encode(body); err != nil {
log.Println("rpc codec: gob error encoding body:", err)
return err
if err = c.enc.Encode(body); err != nil {
log.Println("rpc: gob error encoding body:", err)
return
}
return nil
return
}

func (c *GobCodec) Close() error {
Expand Down
10 changes: 5 additions & 5 deletions gee-rpc/day3-service/codec/gob.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,15 +41,15 @@ func (c *GobCodec) Write(h *Header, body interface{}) (err error) {
_ = c.Close()
}
}()
if err := c.enc.Encode(h); err != nil {
if err = c.enc.Encode(h); err != nil {
log.Println("rpc: gob error encoding header:", err)
return err
return
}
if err := c.enc.Encode(body); err != nil {
if err = c.enc.Encode(body); err != nil {
log.Println("rpc: gob error encoding body:", err)
return err
return
}
return nil
return
}

func (c *GobCodec) Close() error {
Expand Down
10 changes: 5 additions & 5 deletions gee-rpc/day4-timeout/codec/gob.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,15 +41,15 @@ func (c *GobCodec) Write(h *Header, body interface{}) (err error) {
_ = c.Close()
}
}()
if err := c.enc.Encode(h); err != nil {
if err = c.enc.Encode(h); err != nil {
log.Println("rpc: gob error encoding header:", err)
return err
return
}
if err := c.enc.Encode(body); err != nil {
if err = c.enc.Encode(body); err != nil {
log.Println("rpc: gob error encoding body:", err)
return err
return
}
return nil
return
}

func (c *GobCodec) Close() error {
Expand Down
10 changes: 5 additions & 5 deletions gee-rpc/day5-http-debug/codec/gob.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,15 +41,15 @@ func (c *GobCodec) Write(h *Header, body interface{}) (err error) {
_ = c.Close()
}
}()
if err := c.enc.Encode(h); err != nil {
if err = c.enc.Encode(h); err != nil {
log.Println("rpc: gob error encoding header:", err)
return err
return
}
if err := c.enc.Encode(body); err != nil {
if err = c.enc.Encode(body); err != nil {
log.Println("rpc: gob error encoding body:", err)
return err
return
}
return nil
return
}

func (c *GobCodec) Close() error {
Expand Down
10 changes: 5 additions & 5 deletions gee-rpc/day6-load-balance/codec/gob.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,15 +41,15 @@ func (c *GobCodec) Write(h *Header, body interface{}) (err error) {
_ = c.Close()
}
}()
if err := c.enc.Encode(h); err != nil {
if err = c.enc.Encode(h); err != nil {
log.Println("rpc: gob error encoding header:", err)
return err
return
}
if err := c.enc.Encode(body); err != nil {
if err = c.enc.Encode(body); err != nil {
log.Println("rpc: gob error encoding body:", err)
return err
return
}
return nil
return
}

func (c *GobCodec) Close() error {
Expand Down
10 changes: 5 additions & 5 deletions gee-rpc/day7-registry/codec/gob.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,15 +41,15 @@ func (c *GobCodec) Write(h *Header, body interface{}) (err error) {
_ = c.Close()
}
}()
if err := c.enc.Encode(h); err != nil {
if err = c.enc.Encode(h); err != nil {
log.Println("rpc: gob error encoding header:", err)
return err
return
}
if err := c.enc.Encode(body); err != nil {
if err = c.enc.Encode(body); err != nil {
log.Println("rpc: gob error encoding body:", err)
return err
return
}
return nil
return
}

func (c *GobCodec) Close() error {
Expand Down

0 comments on commit e094f10

Please sign in to comment.