thrift-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Yuxuan Wang (Jira)" <j...@apache.org>
Subject [jira] [Commented] (THRIFT-4685) Support the new golang modules (1.11 or later)
Date Wed, 09 Dec 2020 17:09:00 GMT

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

Yuxuan Wang commented on THRIFT-4685:
-------------------------------------

[~slon] Thanks. I understood the situation.

If the only problem is that your codebase needs to import 2 different versions of thrift library,
one from your dependency and one for yourself, one +workaround+ you can do is to use ["git.apache.org/thrift.git/lib/go/thrift"|https://pkg.go.dev/git.apache.org/thrift.git@v0.13.0/lib/go/thrift]
for the one for yourself. You can pass the thrift_import flag to thrift compiler to make sure
that thrift compiled go file also use this import path:

{noformat}
thrift_import=   Override thrift package import path (default:github.com/apache/thrift/lib/go/thrift)
{noformat}

Of course that's just a workaround. It won't work if you actually need 3 or more versions
to co-exist, git.apache.org/thrift.git might disappear/sunset in the future, etc.. But have
you tried that? Although go's toolchain allows you to have 2 versions of the same library
to co-exist as long as they have different import paths, in reality consider thrift's unique
case of compiler get mixed in, I suspect that you will actually face other issues causing
them to not able to co-exist at all. If "github.com/apache/thrift/lib/go/thrift" from your
dependency and "git.apache.org/thrift.git/lib/go/thrift" from your other code cannot really
co-exist in your project, then "github.com/apache/thrift/lib/go/thrift/vN" (or maybe "github.com/apache/thrift/vN/lib/go/thrift",
I haven't tried to see which is actually accepted by go toolchain) won't co-exist either,
so changing the major version won't really help your case.

> Support the new golang modules (1.11 or later)
> ----------------------------------------------
>
>                 Key: THRIFT-4685
>                 URL: https://issues.apache.org/jira/browse/THRIFT-4685
>             Project: Thrift
>          Issue Type: Improvement
>          Components: Go - Library
>    Affects Versions: 0.12.0
>         Environment: golang 1.11 or later
>            Reporter: James E. King III
>            Assignee: Duru Can Celasun
>            Priority: Minor
>
> Go added new module support in 1.11, see:
> https://github.com/golang/go/wiki/Modules
> We should move towards it.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Mime
View raw message