Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Go RPC Error: reading body gob: attempt to decode into a non-pointer

Tags:

go

When I call RPC, this error will happen. While on the server side, I can get the call successfully.

like image 231
icemelon Avatar asked Sep 06 '25 07:09

icemelon


1 Answers

The error is defined at https://golang.org/src/encoding/gob/decoder.go As the error says, decoder need a pointer.

The wrong rpc call is call(address, name, args, reply). Server can receive the call successfully while can not reply, the rpc call fails.

The right way is call(address, name, args, &reply)

like image 60
icemelon Avatar answered Sep 09 '25 16:09

icemelon