[
https://issues.apache.org/jira/browse/THRIFT-3150?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14552403#comment-14552403
]
ASF GitHub Bot commented on THRIFT-3150:
----------------------------------------
GitHub user kostya-sh opened a pull request:
https://github.com/apache/thrift/pull/505
THRIFT-3150 go: add option to generate non-exported Read and Write me…
…thods
This change adds a new option to Go trift compiler: dont_export_rw.
When it is specified generated Read and Write methods will be called 'read'
and
'write' (and hence are non-exported).
This can be useful if a package author wants to make the generated structs
part
of public package API but doesn't want the package depend on thrift
library. This will make vendoring thrift library easier too.
You can merge this pull request into a Git repository by running:
$ git pull https://github.com/kostya-sh/thrift THRIFT-3150
Alternatively you can review and apply these changes as the patch at:
https://github.com/apache/thrift/pull/505.patch
To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:
This closes #505
----
commit 0f06ab30179b1a70248e5d56a70e7f41d037695f
Author: Konstantin Shaposhnikov <[email protected]>
Date: 2015-05-20T14:26:26Z
THRIFT-3150 go: add option to generate non-exported Read and Write methods
This change adds a new option to Go trift compiler: dont_export_rw.
When it is specified generated Read and Write methods will be called 'read'
and
'write' (and hence are non-exported).
This can be useful if a package author wants to make the generated structs
part
of public package API but doesn't want the package depend on thrift
library. This will make vendoring thrift library easier too.
----
> Add an option to thrift go generator to make Read and Write methods private
> ---------------------------------------------------------------------------
>
> Key: THRIFT-3150
> URL: https://issues.apache.org/jira/browse/THRIFT-3150
> Project: Thrift
> Issue Type: Improvement
> Components: Go - Compiler
> Affects Versions: 0.9.2
> Reporter: Konstantin Shaposhnikov
>
> I propose to add a new option *keep_thrift_private* (better name suggestions
> are welcome) to go generator that if set will make go generator generate
> private read() and wirte() methods instead of public ones. E.g.:
> {code}
> func (p *Statistics) read(iprot thrift.TProtocol) error {
> ...
> }
> func (p *Statistics) write(oprot thrift.TProtocol) error {
> ....
> }
> {code}
> 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).
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)