Add support of overriding function names in Go through annotations
commitf44e2bf4459235df69253a3317ea1a8d3730fe38
authorDmitrii Okunev <xaionaro@fb.com>
Fri, 9 Sep 2022 16:11:47 +0000 (9 09:11 -0700)
committerFacebook GitHub Bot <facebook-github-bot@users.noreply.github.com>
Fri, 9 Sep 2022 16:11:47 +0000 (9 09:11 -0700)
tree6ffa60c473bc70c71fc49a27b8ff38aae5852066
parent8b10c0d7d4dd9bedc9e78b9f61ae5ab8cb680243
Add support of overriding function names in Go through annotations

Summary:
Just adding a feature to set a function name for Go through annotations.

An use case example:
Language Go has specific constraints about function names. Because of that Thrift compiler modifies function names to satisfy Go requirements. Which creates some incompatibilities with other languages. For example, it is expected that having simultaneously API functions `get_value` and `GetValue` would cause an error only in Go. But more importantly, thrift-code in Go already has method `GetStatus`, so when somebody define method (for example:) `get_status` it will get an error. And the annotations would allow to manually redefine the function name and avoid the error.

The initial problem is posted here: https://fb.workplace.com/groups/codegophers/permalink/9557809194267610/

Reviewed By: leoleovich, iahs

Differential Revision: D39314589

fbshipit-source-id: 73be847b837a294b4125d47408878d9e543438f1
third-party/thrift/src/thrift/compiler/generate/t_go_generator.cc
third-party/thrift/src/thrift/compiler/test/fixtures/basic-annotations/gen-go/module/myservice.go
third-party/thrift/src/thrift/compiler/test/fixtures/basic-annotations/gen-json/module.json
third-party/thrift/src/thrift/compiler/test/fixtures/basic-annotations/gen-py3/module/services_reflection.pyx
third-party/thrift/src/thrift/compiler/test/fixtures/basic-annotations/src/module.thrift