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

Add an option to thrift go generator to make Read and Write methods private

    XMLWordPrintableJSON

    Details

    • Type: Improvement
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 0.9.2
    • Fix Version/s: 0.9.3
    • Component/s: Go - Compiler
    • Labels:
      None

      Description

      I propose to add a new option dont_export_rw to go generator that if set will make it generate private read() and wirte() methods instead of public ones. E.g.:

      func (p *Statistics) read(iprot thrift.TProtocol) error {
      ...
      }
      
      func (p *Statistics) write(oprot thrift.TProtocol) error {
      ....
      }
      

      This will allow (along with THRIFT-3149) to generate a package that doesn't reference any symbols from Thrift Go library in public API.

      There are two main benefits:

      • keeping API of generated packages clean (only generated types are exported)
      • allowing to generate packages that can use vendored thrift library (e.g. placed inside internal/ directory).

        Attachments

          Activity

            People

            • Assignee:
              k.shaposhnikov@gmail.com Konstantin Shaposhnikov
              Reporter:
              k.shaposhnikov@gmail.com Konstantin Shaposhnikov
            • Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: