Protocol Buffer interoperability between Go's goprotobuf and JavaScript (using closure-library's goog.proto2).
Example message:
message Person {
optional int32 id = 1;
optional string name = 2;
optional string email = 3;
}
Example encoding:
[null,1,null,"user@example.com"]
Example encoding (zero-index):
[1,null,"user@example.com"]
Example message:
message Person {
optional int32 id = 1;
optional string name = 2;
optional string email = 3;
}
Example encoding (tag name):
{"id":1,"email":"user@example.com"}
Example encoding (tag number):
{"1":1,"3":"user@example.com"}
$ # setup environment (GOPATH, etc)
$ go get gopkg.in/samegoal/protoclosure.v0
$ cd gopkg.in/samegoal/protoclosure.v0
$ # modify the source
$ go test -race
$ make # run vet/fmt/lint, prior to sending Pull Request
To regenerate unit test protobuf files:
protoc --go_out=. gopkg.in/samegoal/protoclosure.v0/test.proto
protoc --go_out=. gopkg.in/samegoal/protoclosure.v0/package_test.proto
mv gopkg.in/samegoal/protoclosure.v0/test.pb.go gopkg.in/samegoal/protoclosure.v0/test.pb/
mv gopkg.in/samegoal/protoclosure.v0/package_test.pb.go gopkg.in/samegoal/protoclosure.v0/package_test.pb/
goprotobuf limitations: