[ 
https://issues.apache.org/jira/browse/THRIFT-3131?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14543072#comment-14543072
 ] 

Konstantin Shaposhnikov commented on THRIFT-3131:
-------------------------------------------------

The question of versioning of Go libraries is a very heated topic that people 
like to discuss however there is no official way to version libraries in Go.

I think best a library developer can do in this situation is to avoid making 
breaking changes and always maintain backward compatibility. In thrift case it 
means that for versions X and Y (X comes before Y) of thrift:
- all bindings generated by thrift compiler X should work with Go Thrift 
library X and Y
- all programs written against Go Thrift library X should work with version Y 
with no modifications
- the binary formats should not change (though I guess this is already 
guaranteed)

Basically all code written against Thrift Go Library should work with trunk 
(master) version as well. In case of backward incompatible changes the import 
path should be changed. E.g. to 
git-wip-us.apache.org/repos/asf/thrift.git/lib/go/thrift2

If users of Thrift Go library want reproducible builds they still can use third 
party tools like godep or vendor (commit to their repo) Go Thrift library under 
a different import path.

In fact I've seen this happening with Java Thrift library where it is often 
gets shaded (binary vendoring ;). E.g. if I write a library that uses Thrift to 
serialize/deserialize some objects however I do not want users of my library 
suffer resolving various versions of thrift that might come from other 
dependencies I can package thrift.jar inside mylibrary.jar changing its package 
from _org.apache.thrift_ to _com.mycompany.mylibrary.org.apache.thrift_. Of 
course in this case public API of my library shouldn't use any of thrift 
classes.

BTW it would be helpful to better support this use case in Thrift Go. Currently 
all Read and ReadFieldN (but surprisingly not writeFiledN) generated methods 
are public. I think ReadFieldN methods should be private by default and there 
should be an option to thrift compiler to make Read methods private as well. 
This will allow library developers to make all methods that depend on Thrift 
private enabling vendoring of thrift library.


> Make suggested import path for go thrift library consistent with generated 
> code
> -------------------------------------------------------------------------------
>
>                 Key: THRIFT-3131
>                 URL: https://issues.apache.org/jira/browse/THRIFT-3131
>             Project: Thrift
>          Issue Type: Improvement
>          Components: C++ - Compiler, Go - Library
>            Reporter: Konstantin Shaposhnikov
>
> https://github.com/apache/thrift/blob/master/lib/go/README.md suggests to use 
> the following import path for go thrift library:
> git-wip-us.apache.org/repos/asf/thrift.git/lib/go/thrift
> However thrift compiler uses different import path in the generated files by 
> default:
> git.apache.org/thrift.git/lib/go/thrift 
> To avoid confusion it would be good to use a single import path both in the 
> generated code and in the user documentation.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to