[
https://issues.apache.org/jira/browse/THRIFT-3338?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Jens Geyer resolved THRIFT-3338.
--------------------------------
Resolution: Fixed
Fix Version/s: 0.9.3
Committed.
> Stray underscore in generated go when service name starts with "New"
> --------------------------------------------------------------------
>
> Key: THRIFT-3338
> URL: https://issues.apache.org/jira/browse/THRIFT-3338
> Project: Thrift
> Issue Type: Bug
> Components: Go - Compiler
> Affects Versions: 1.0
> Environment: OS X, go1.4.2
> Reporter: Patrick Mahoney
> Assignee: Jens Geyer
> Priority: Minor
> Fix For: 0.9.3
>
> Attachments:
> 0001-THRIFT-3338-Stray-underscore-in-generated-go-when-se.patch
>
>
> Running against Thrift master branch at revision
> [ff4a8ed|https://git-wip-us.apache.org/repos/asf?p=thrift.git;a=commit;h=ff4a8edd50621fb6aab7dbbf6968d4322700ed7d],
> 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.
> {code}
> ################################
> # 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 {
> ...
> {code}
> {code}
> $ thrift --version
> Thrift version 1.0.0-dev
> $ go version
> go version go1.4.2 darwin/amd64
> {code}
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)