pbactor-bandage
Change actor.PID.MarshalToSizedBuffer to actor.PID.MarshalTo for protoactor-go
About
When I try out protoactor-go I encounter a problem with protobuf.
A typical .proto
looks like this
syntax = "proto3";
package messages;
import "github.com/AsynkronIT/protoactor-go/actor/protos.proto";
message Hello {
actor.PID Sender = 1;
string Message = 2;
}
and then compile it to go
$ protoc -I=. -I=$GOPATH\src --gogoslick_out=plugins=grpc:. protos.proto
here is the problem, the gogo/protobuf somehow upgrade their toolchain, the MarshalTo
is replaced by MarshalToSizedBuffer
, when the protoactor-go is still using the old version
Luckly, we can modify the compiled protobuf file to make it compatible.
This tool is just replace invocation of func (pid *actor.PID) MarshalToSizedBuffer([]byte) (int, error)
to func (pid *actor.PID) MarshalTo([]byte) (int error)
Usage
This tool took a lot of code from goimports
usage: pbactor-bandage [flags] [path ...]
-v verbose logging
-w write result to (source) file instead of stdout