Krzysztof Godlewski created THRIFT-2311:
-------------------------------------------
Summary: Go: invalid code generated when exception name is a go
keyword
Key: THRIFT-2311
URL: https://issues.apache.org/jira/browse/THRIFT-2311
Project: Thrift
Issue Type: Bug
Components: Go - Compiler
Environment: All platforms
Reporter: Krzysztof Godlewski
Attachments: thrift-go.patch
Go code generator emits invalid code when a service method is declared to throw
an exception, which name is a Go keyword.
To reproduce, create gobug.thrift:
{code:title=gobug.thrift}
exception FooError { }
service Foo {
void bar() throws (1: FooError error)
}
{code}
Run:
{code}
thrift -gen go gobug.thrift && (cd gen-go/gobug && go build -a)
{code}
This should result in the following error:
{code}
./foo.go:106: result1.Error undefined (type *BarResult has no field or method
Error)
./foo.go:107: type error is not an expression
./foo.go:107: cannot assign to <nil>.error
./foo.go:107: result1.Error undefined (type *BarResult has no field or method
Error)
{code}
--
This message was sent by Atlassian JIRA
(v6.1.5#6160)