thrift-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Josh Yudaken (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (THRIFT-4797) Generated Go code produces name collisions on imports
Date Tue, 12 Feb 2019 16:58:00 GMT

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

Josh Yudaken commented on THRIFT-4797:
--------------------------------------

[~jensg] - Yes, a namespace like `sample.project.project_common` and `sample.thing.thing_common`
would solve the problem... but that means in a large project every final component of the
namespace has to be unique.

We have a *lot* of namespaces ending in `.common`, `.event`, `.client`, `.v1`, etc.

 

I don't have time right now but will work on a pull request for this in the next couple weeks.
If anyone wants to take it off my hand I'll check in on this thread before starting work on
it.

> Generated Go code produces name collisions on imports
> -----------------------------------------------------
>
>                 Key: THRIFT-4797
>                 URL: https://issues.apache.org/jira/browse/THRIFT-4797
>             Project: Thrift
>          Issue Type: Bug
>          Components: Go - Compiler
>    Affects Versions: 0.12.0
>            Reporter: Josh Yudaken
>            Priority: Major
>
> If two modules have the same name, the produced go code will not compile.
> For example:
> {code:java}
> import (
>   "github.com/sample/project/common"
>   "github.com/different/thing/common"
> ){code}
> In go the final component (commons) is used as the name so there is a collision.
> This can be fixed by aliasing the modules
> {code:java}
> import (
>   common_1 "github.com/sample/project/common"
>   common_2 "github.com/different/thing/common"
> ){code}
>  



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Mime
View raw message