From 6ce59c75e24cda0a0898aebb842eec0cf766916a Mon Sep 17 00:00:00 2001 From: davyxu Date: Wed, 24 Mar 2021 15:46:36 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0golexer=20=E4=BF=AE=E5=A4=8DA?= =?UTF-8?q?utoMsgID=E4=B8=8D=E8=AF=86=E5=88=AB=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- example/csharp/Example/ProtoGenReg.cs | 4 ++-- go.mod | 2 +- go.sum | 2 ++ tests/Make.sh | 3 +++ tests/code.proto | 4 ++-- tests/reg_gen.go | 4 ++-- tests/route.json | 2 +- 7 files changed, 13 insertions(+), 8 deletions(-) diff --git a/example/csharp/Example/ProtoGenReg.cs b/example/csharp/Example/ProtoGenReg.cs index feafab9..492078f 100644 --- a/example/csharp/Example/ProtoGenReg.cs +++ b/example/csharp/Example/ProtoGenReg.cs @@ -36,14 +36,14 @@ public static void Visit(Action callback) callback(new MetaInfo { Type = typeof(LoginREQ), - ID = 0, + ID = 45589, SourcePeer = "client", TargetPeer = "game", }); callback(new MetaInfo { Type = typeof(LoginACK), - ID = 0, + ID = 7420, SourcePeer = "", TargetPeer = "", }); diff --git a/go.mod b/go.mod index 5816f55..e54cdb4 100644 --- a/go.mod +++ b/go.mod @@ -4,7 +4,7 @@ go 1.12 require ( github.com/davyxu/cellnet v4.1.0+incompatible - github.com/davyxu/golexer v0.0.0-20180314091252-f048a86ae200 + github.com/davyxu/golexer v0.1.1-0.20200202091144-a15ddde83f6a github.com/davyxu/ulexer v0.0.0-20200705151509-86177890ec50 github.com/stretchr/testify v1.6.1 ) diff --git a/go.sum b/go.sum index a83fbca..a82d02d 100644 --- a/go.sum +++ b/go.sum @@ -13,6 +13,8 @@ github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davyxu/golexer v0.0.0-20180314091252-f048a86ae200 h1:qLWlQBFg5c7HUOK+UdoGouLzRaYBQr2WwoAqixU+eik= github.com/davyxu/golexer v0.0.0-20180314091252-f048a86ae200/go.mod h1:K/1PVWqaQEwMs+N+VvaoS66o1BAAwso+jEgXKBIa8QY= +github.com/davyxu/golexer v0.1.1-0.20200202091144-a15ddde83f6a h1:VYps2zwgBJPNuLGLiPrR4w6ud6cJpwlBA1OOytrCpx4= +github.com/davyxu/golexer v0.1.1-0.20200202091144-a15ddde83f6a/go.mod h1:dCUDBJcBQ9/AOzz6++KvSetGgVf5zXphevt6LQvKy0A= github.com/davyxu/goobjfmt v0.1.0/go.mod h1:KKrytCtCXny2sEg3ojQfJ4NThhBP8hKw/qM9vhDwgog= github.com/davyxu/protoplus v0.1.0/go.mod h1:WzmNYPvYsyks3G81jCJ/vGY2ljs49qFMfCmXGwvxFLA= github.com/davyxu/ulog v1.0.0 h1:CfKRT2yK1JStZH5Yeal3BtF3kj/OETt1gTchuAbekBU= diff --git a/tests/Make.sh b/tests/Make.sh index b2c21a8..44bb5fc 100644 --- a/tests/Make.sh +++ b/tests/Make.sh @@ -1,4 +1,7 @@ #!/usr/bin/env bash + +set -e + go build -v -o=${GOPATH}/bin/protoplus github.com/davyxu/protoplus/cmd/protoplus # code.proto为输入文件 diff --git a/tests/code.proto b/tests/code.proto index 419a1e1..978a15d 100644 --- a/tests/code.proto +++ b/tests/code.proto @@ -94,12 +94,12 @@ struct MyType EnumSlice []MyEnum } -[MsgDir: "client -> game"] +[AutoMsgID MsgDir: "client -> game"] struct LoginREQ { } - +[AutoMsgID] struct LoginACK { } diff --git a/tests/reg_gen.go b/tests/reg_gen.go index 0c0dc49..c0c47a6 100644 --- a/tests/reg_gen.go +++ b/tests/reg_gen.go @@ -36,13 +36,13 @@ func init() { cellnet.RegisterMessageMeta(&cellnet.MessageMeta{ Codec: codec.MustGetCodec("protoplus"), Type: reflect.TypeOf((*LoginREQ)(nil)).Elem(), - ID: 0, + ID: 17076, New: func() interface{} { return &LoginREQ{} }, }) cellnet.RegisterMessageMeta(&cellnet.MessageMeta{ Codec: codec.MustGetCodec("protoplus"), Type: reflect.TypeOf((*LoginACK)(nil)).Elem(), - ID: 0, + ID: 44443, New: func() interface{} { return &LoginACK{} }, }) } diff --git a/tests/route.json b/tests/route.json index 8b37a33..f3fb34d 100644 --- a/tests/route.json +++ b/tests/route.json @@ -2,7 +2,7 @@ "Rule": [ { "MsgName": "proto.LoginREQ", - "MsgID": 0, + "MsgID": 45589, "SvcName": "game" } ]