我有那些节俭接口:
./thrift/a/a1.thrift
./thrift/a/a2.thrift
./thrift/b/b1.thrift
./thrift/b/b2.thrift
其中a1.thrift包含a2,b1,b2(带include "thrift/a/a2.thrift"
)
我为thrift -r --gen go:package_prefix=work -I . --out . thrift/a/a1.thrift
输出:
./a1/constants.go
./a1/ttypes.go
./a2/...
./b1/...
./b2/...
如何告诉thrift输出?
./a/a1/...
./a/a2/...
./b/b1/...
./b/b2/...
请注意,我可以手动移动这些文件,但首先我在Go 中有许多和第二个文件包必须匹配目录,所以我需要编辑这些文件。例如,为a1生成的Go文件将导入a2为work/a2
而不是work/a/a2
)
答案 0 :(得分:1)
使用名称空间。在每个IDL文件的顶部添加类似于以下内容的行:
thrift -r -gen go a1.thrift
运行
gen-go/a/a1/*
在
下创建文件More