pbactor-bandage

command module
v0.0.0-...-e7d33f8 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 13, 2019 License: Apache-2.0 Imports: 17 Imported by: 0

README

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

Documentation

The Go Gopher

There is no documentation for this package.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL