TarsCloud / Tars

Tars is a high-performance RPC framework based on name service and Tars protocol, also integrated administration platform, and implemented hosting-service via flexible schedule.
BSD 3-Clause "New" or "Revised" License
9.79k stars 2.08k forks source link

Golang下Tars协议定义默认值无效 #836

Closed happyz90 closed 3 years ago

happyz90 commented 3 years ago

Tars文件中定义如下:

    struct UpdateFieldInfo
    {
        1 require bool replace = true;
        2 require UpdateValue upDateValue;
    };

执行如下代码:

    uv := DCache.UpdateFieldInfo{}
    fmt.Println(uv)

得到结果:

{false {0 }}

在构造UpdateFieldInfo时,replace并没有按照tars协议中定义的默认值进行初始化。

ruanshudong commented 3 years ago

貌似缺省值只有在optional模式下才有效