[
https://issues.apache.org/jira/browse/THRIFT-4610?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16569319#comment-16569319
]
Can Celasun commented on THRIFT-4610:
-------------------------------------
There shouldn't be
{code:java}
import "shared"
{code}
in the first place. If you have {{foo.thrift}} and {{bar.thrift both with
"}}{{package shared}}", and foo imports bar, and you generate with:
{code:java}
for f in *.thrift; do
thrift -r -out outputdir --gen go "$f"
done
{code}
there will be no such imports in the generated files.
> [GO] Include directive compiles to language-default import
> ----------------------------------------------------------
>
> Key: THRIFT-4610
> URL: https://issues.apache.org/jira/browse/THRIFT-4610
> Project: Thrift
> Issue Type: Question
> Components: Go - Compiler
> Affects Versions: 0.11.0
> Reporter: Ermolay Romanov
> Priority: Critical
>
> Thrift IDL utilizing an `include` statement such as:
> {code:java}
> include "shared.thrift"{code}
> creates a golang package that has:
> {code:java}
> import (
> ...
> "shared"
> ...
> ){code}
> code.
>
> In addition to that, if passing a package= directive to the CLI:
> {code:java}
> thrift --gen go:package=mommy{code}
> the resulting code has an import of the root "mommy" package — I think it
> replaces not only the gen-go package name with whatever is passed to the CLI
> but also the name of that import. *So it basically tries to import itself.*
>
> Expected: the code generator would pull needed imports and bundle them with
> the generated Go code, removing any need for importing anything further.
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)