You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@thrift.apache.org by "Jens Geyer (Jira)" <ji...@apache.org> on 2026/10/20 22:25:00 UTC

[jira] [Resolved] (THRIFT-6384) Go -remote stub calls ReadField instead of the argument's field id, so it does not compile for some container arguments

     [ https://issues.apache.org/jira/browse/THRIFT-6384?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Jens Geyer resolved THRIFT-6384.
--------------------------------
      Assignee: Sylwester Lachiewicz
    Resolution: Fixed

> Go -remote stub calls ReadField<position> instead of the argument's field id, so it does not compile for some container arguments
> ---------------------------------------------------------------------------------------------------------------------------------
>
>                 Key: THRIFT-6384
>                 URL: https://issues.apache.org/jira/browse/THRIFT-6384
>             Project: Thrift
>          Issue Type: Bug
>          Components: Go - Compiler
>    Affects Versions: 0.24.0, 0.25.0
>            Reporter: Sylwester Lachiewicz
>            Assignee: Sylwester Lachiewicz
>            Priority: Major
>             Fix For: 0.26.0
>
>          Time Spent: 0.5h
>  Remaining Estimate: 0h
>
> The {{-remote}} tool the Go generator writes decodes a container argument by calling {{ReadField<N>}} on the args struct, with N the argument's position ({{i + 1}} in [t_go_generator.cc|https://github.com/apache/thrift/blob/master/compiler/cpp/src/thrift/generate/t_go_generator.cc]). The args struct names its read methods after the field id, so the call does not compile whenever a container argument's id differs from its position: an explicit id other than the position, or no id at all (implicit ids are negative, and the method is {{ReadField_1}}).
> {noformat}
> namespace go remotemin
> service S {
>   void a(set<i32> opts)
>   void d(5: list<i32> xs)
>   void e(1: i32 a, 3: map<string,i32> m)
> }
> {noformat}
> {noformat}
> s-remote/s-remote.go: containerStruct0.ReadField1 undefined (type *remotemin.SAArgs has no field or method ReadField1)
> s-remote/s-remote.go: containerStruct0.ReadField1 undefined (type *remotemin.SDArgs has no field or method ReadField1)
> s-remote/s-remote.go: containerStruct1.ReadField2 undefined (type *remotemin.SEArgs has no field or method ReadField2)
> {noformat}
> The stub is a package inside the generated tree, so {{go build ./...}} over the generated code fails. Apache IoTDB's confignode.thrift hits it, for example with {{clearCache(set<i32> cacheClearOptions)}} and {{getSchemaPartitionTableWithSlots(map<string, list<common.TSeriesPartitionSlot>> dbSlotMap)}}. Scalar arguments are not affected. The code is the same in 0.24.0, 0.25.0 and master.
> Related: THRIFT-6200, THRIFT-6239.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)