mac安裝
brew install thirft
查看命令幫助
thirft --help
-o path Set the output directory for gen-* packages (default: current directory)
-out dirname Set the ouput location for generated files.(no gen-* folder will be created)
-I dir Add a directory to the list of directories
searched for include directives
-strict Strict compiler warnings on
-v[erbose] Verbose mode
-r[ecurse] Also generate included files
-debug Parse debug trace to stdout
--allow-neg-keys Allow negative field keys (Used to preserve protocol
compatibility with older .thrift files)
--allow-64bit-consts Do not print warnings about using 64-bit constants
--gen STR Generate code with a dynamically-registered generator.
(這里描述的是下面語言相關(guān)的附加參數(shù)的使用方式)
STR has the form language[:key1=val1[,key2[,key3=val3]]].
Keys and values are options passed to the generator.
Many options will not require values.
go (Go):
package_prefix= Package prefix for generated files. 生成文件的包前綴(有用)
thrift_import= Override thrift package import path (default:github.com/apache/thrift/lib/go/thrift) 重寫
package= Package name (default: inferred from thrift file name) 重寫gen包名
ignore_initialisms Disable automatic spelling correction of initialisms (e.g. "URL")
read_write_private Make read/write methods private, default is public Read/Write
注:額外命令使用方式 thrift --gen go:package_prefix=ownprefix,thrift_import=xxxxxx -o rpcgo demo.thrift