Uploaded image for project: 'Thrift'
  1. Thrift
  2. THRIFT-3491

Invalid Go Code From Service Signatures With Typedef'd Structs

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Open
    • Priority: Major
    • Resolution: Unresolved
    • Affects Version/s: 0.9.3
    • Fix Version/s: None
    • Component/s: Go - Compiler

      Description

      Thrift 0.9.3 produces invalid Go code when service definitions are written in terms of type-deffed structs.

      namespace go bug
      struct Foo {
      	1:string s,
      }
      typedef Foo Bar
      service BarService {
      	Bar getBar()
      }
      

      Attempting to compile the Go code that Thrift outputs yields the following errors.

      bug/barservice.go:192: cannot use retval (type Bar) as type *Bar in assignment
      bug/barservice.go:323: cannot use Foo literal (type *Foo) as type *Bar in assignment
      bug/barservice.go:324: p.Success.Read undefined (type *Bar has no field or method Read)
      bug/barservice.go:351: p.Success.Write undefined (type *Bar has no field or method Write)
      

      Inspecting the Go code, it appears that the Go compiler is telling the truth.

        Attachments

          Activity

            People

            • Assignee:
              dcelasun Duru Can Celasun
              Reporter:
              tom.deering Tom Deering
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated: