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

Invalid golang code generated for optional set<binary> with a default value

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 0.15.0, 0.14.2
    • 0.16.0
    • Go - Compiler
    • None

    Description

      There's a bug in the Thrift Go generator that happens when an optional set<bynary> is used with a default value. For example, a simple struct like this:

      struct OptionalSetBinary {
        1: optional set<binary> bin = {}
      }
      

      ...generates a default value like this:

      var OptionalSetBinary_Bin_DEFAULT [][]byte = []string{
      }
      

      ...and fails the compilation of the unit-test:

      ../src/gen/thrifttest/ThriftTest.go:5620:5: cannot use []string{} (type []string) as type [][]byte in assignment
      

      Attachments

        Issue Links

          Activity

            People

              vernor1 Yuri Melnikov
              vernor1 Yuri Melnikov
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Time Tracking

                  Estimated:
                  Original Estimate - 24h
                  24h
                  Remaining:
                  Remaining Estimate - 24h
                  24h
                  Logged:
                  Time Spent - Not Specified
                  Not Specified