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

Stray underscore in generated go when service name starts with "New"

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Minor
    • Resolution: Fixed
    • None
    • 0.9.3
    • Go - Compiler
    • None
    • OS X, go1.4.2

    Description

      Running against Thrift master branch at revision ff4a8ed, a service with a name starting with "New" results in some generated code having an extra underscore, and thus not correctly referring to a defined datatype.

      In the example below, to simple services are created, one names "Something" and the other "Newsomething".

      Note in the "Newsomething" service, the generated type is newsomethingProcessorFunc while in NewNewsomething_Processor it is referred to as newsomething_ProcessorFunc which fails to compile.

      ################################
      # file s.thrift
      service Something {
        void func(1: i64 i)
      }
      service Newsomething {
        void func(1: i64 i)
      }
      
      ################################
      $ thrift thrift -out gen --gen go s.thrift 
      
      ################################
      #  file gen/s/something.go
      func NewSomethingProcessor(handler Something) *SomethingProcessor {
      	...
      	self7.processorMap["func"] = &somethingProcessorFunc{handler: handler}
      	...
      }
      
      type somethingProcessorFunc struct {
      ...
      
      ################################
      # file gen/s/newsomething.go
      func NewNewsomething_Processor(handler Newsomething_) *Newsomething_Processor {
      	...
      	self2.processorMap["func"] = &newsomething_ProcessorFunc{handler: handler}
      	...
      }
      
      type newsomethingProcessorFunc struct {
      ...
      
      
      $ thrift --version
      Thrift version 1.0.0-dev
      $ go version
      go version go1.4.2 darwin/amd64
      

      Attachments

        Activity

          People

            jensg Jens Geyer
            patrick.mahoney@rackspace.com Patrick Mahoney
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: