Closed otoolep closed 10 years ago
Specifically, this is the build error:
~/r/raft (master)$ go build
# github.com/goraft/raft/protobuf
src/github.com/goraft/raft/protobuf/append_entries_request.pb.go:113: undefined: proto.ErrWrongType
src/github.com/goraft/raft/protobuf/append_entries_request.pb.go:130: undefined: proto.ErrWrongType
src/github.com/goraft/raft/protobuf/append_entries_request.pb.go:147: undefined: proto.ErrWrongType
src/github.com/goraft/raft/protobuf/append_entries_request.pb.go:164: undefined: proto.ErrWrongType
src/github.com/goraft/raft/protobuf/append_entries_request.pb.go:181: undefined: proto.ErrWrongType
src/github.com/goraft/raft/protobuf/append_entries_request.pb.go:204: undefined: proto.ErrWrongType
src/github.com/goraft/raft/protobuf/append_entries_responses.pb.go:97: undefined: proto.ErrWrongType
src/github.com/goraft/raft/protobuf/append_entries_responses.pb.go:114: undefined: proto.ErrWrongType
src/github.com/goraft/raft/protobuf/append_entries_responses.pb.go:131: undefined: proto.ErrWrongType
src/github.com/goraft/raft/protobuf/append_entries_responses.pb.go:148: undefined: proto.ErrWrongType
src/github.com/goraft/raft/protobuf/append_entries_responses.pb.go:148: too many errors
~/r/raft (master)$
I'm experiencing this issue myself, couldn't figure out how to regenerate the protocol buffers successfully, so I started used the raft library frozen in _vendors by github.com/influxdb/influxdb.
@swsnider -- that's exactly what I've done too. :-)
I wish there were clear instructions on how to re-generate these files.
I don't re-generate files but replace all proto.ErrWrongType
with customized ErrWrongType
error. It's not grace but simple. :)
I've forked the repo to here and dropped in the latest copies from influxb. My fork now builds.
@otoolep -- there's some instructions can fix this issue:
cd into 'raft/protobuf' directory, run command below:
protoc --go_out=. -I. -I/usr/include -I$GOPATH *.proto
There might be some extra installion depending your system, on my machine I also installed gogoprotobuf and libprotoc-dev.
Wishes to help people suffering with this issue.
Thank you @hanlz.
@otoolep @swsnider Can you guys confirm that this PR from @hanlz works and I'll merge it in.
Yes, if I merge @hanlz master into the raft source, I can then build.
~/coding/check/src/github.com/goraft/raft (master)$ git remote add hanlz https://github.com/hanlz/raft.git
~/coding/check/src/github.com/goraft/raft (master)$ git pull hanlz master
remote: Counting objects: 12, done.
remote: Compressing objects: 100% (12/12), done.
remote: Total 12 (delta 6), reused 0 (delta 0)
Unpacking objects: 100% (12/12), done.
From https://github.com/hanlz/raft
* branch master -> FETCH_HEAD
Updating 73f9c44..ec41f00
Fast-forward
protobuf/append_entries_request.pb.go | 633 +++----------------------------------------------------------------
protobuf/append_entries_responses.pb.go | 503 +-----------------------------------------------------
protobuf/log_entry.pb.go | 505 +-----------------------------------------------------
protobuf/request_vote_request.pb.go | 505 +-----------------------------------------------------
protobuf/request_vote_responses.pb.go | 411 +-------------------------------------------
protobuf/snapshot_recovery_request.pb.go | 823 +---------------------------------------------------------------------------------------
protobuf/snapshot_recovery_response.pb.go | 457 +------------------------------------------------
protobuf/snapshot_request.pb.go | 459 +------------------------------------------------
protobuf/snapshot_response.pb.go | 365 +--------------------------------------
9 files changed, 74 insertions(+), 4587 deletions(-)
~/coding/check/src/github.com/goraft/raft (master)$ go build
protobuf/append_entries_request.pb.go:24:8: cannot find package "code.google.com/p/goprotobuf/proto" in any of:
/home/philip/coding/go/src/pkg/code.google.com/p/goprotobuf/proto (from $GOROOT)
/home/philip/coding/check/src/code.google.com/p/goprotobuf/proto (from $GOPATH)
~/coding/check/src/github.com/goraft/raft (master)$ go get
~/coding/check/src/github.com/goraft/raft (master)$ go build
~/coding/check/src/github.com/goraft/raft (master)$
So it looks good to me.
You're welcome, but there might be a little difference of package reference, I'm using goprotobuf but not gogoprotobuf to generate the pb files.
This change has broken the build.
https://code.google.com/p/gogoprotobuf/issues/detail?id=23
Can you please regenerate your protobuf files?