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

Go Map value type is dependent on order of entity definitions

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Minor
    • Resolution: Fixed
    • None
    • 0.10.0
    • Go - Compiler

    Description

      Deserialization code of map type properties will generate a compilation error if the type definition of the value appears after the definition of the map where it is used.

      Error Example
      struct TestsResponse {
      	1: map<string, Test> tests
      }
      
      struct Test {
      	1: string id
      	2: string name
      }
      

      Compilation Error

      ttypes.go:83: cannot use _val1 (type *Test) as type Test in assignment

      In the example moving the definition of 'Test' to appear before 'TestResponse' avoids the compilation error.

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              msanders21 Matt Sanders
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: