You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@thrift.apache.org by "Konstantin Shaposhnikov (JIRA)" <ji...@apache.org> on 2015/05/20 16:35:02 UTC

[jira] [Updated] (THRIFT-3150) Add an option to thrift go generator to make Read and Write methods private

     [ https://issues.apache.org/jira/browse/THRIFT-3150?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Konstantin Shaposhnikov updated THRIFT-3150:
--------------------------------------------
    Description: 
I propose to add a new option *dont_export_rw* to go generator that if set will make it 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).


  was:
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).



> 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 *dont_export_rw* to go generator that if set will make it 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)