deal with collision by annotating

https://github.com/capnproto/go-capnproto2/issues/457
This commit is contained in:
Keyvan Fatehi
2023-02-19 17:17:05 -08:00
parent 318f100987
commit c6072ab5ea
3 changed files with 14 additions and 3 deletions

3
.gitmodules vendored
View File

@@ -1,3 +1,6 @@
[submodule "cereal"]
path = cereal
url = https://github.com/commaai/cereal.git
[submodule "go-capnproto2"]
path = go-capnproto2
url = https://github.com/capnproto/go-capnproto2.git

View File

@@ -11,11 +11,18 @@ for f in ../../*.capnp; do
echo "using Go = import \"/go.capnp\";" > $out
echo "\$Go.package(\"cereal\");" >> $out
echo "\$Go.import(\"cereal\");" >> $out
cat $f | grep -v 'c++.capnp' | grep -v '$Cxx.namespace' >> $out
cat $f |\
# Remove the C++ imports
grep -v 'c++.capnp' | grep -v '$Cxx.namespace' |\
# Avoid collisions by annotating
sed 's/message @6 :Text;/message @6 :Text $Go.name("text");/'\
>> $out
done
go install capnproto.org/go/capnp/v3/capnpc-go@latest
capnp compile -I$(go env GOPATH)/src/capnproto.org/go/capnp/std -o go:../../gen/go *.capnp
# go install capnproto.org/go/capnp/v3/capnpc-go@latest
# capnp compile -I$(go env GOPATH)/src/capnproto.org/go/capnp/std -o go:../../gen/go *.capnp
capnp compile -I../../../go-capnproto2/std -o go:../../gen/go *.capnp
popd # leave ./tmp/go
rm -rf tmp
## Services

1
go-capnproto2 Submodule

Submodule go-capnproto2 added at 285a677057