LinuxCommandLibrary
GitHubF-DroidGoogle Play Store

kitex

generates Go code from Thrift or Protobuf IDL files

TLDR

Generate service code
$ kitex -module [module] [idl_file.thrift]
copy
Generate client code
$ kitex -module [module] -client [idl_file.thrift]
copy
Specify service name
$ kitex -module [module] -service [svc] [idl.thrift]
copy
Use Protobuf
$ kitex -module [module] [idl.proto]
copy
Specify IDL include path
$ kitex -module [module] -I [path/to/includes] [idl.thrift]
copy
Reuse existing kitex_gen directory
$ kitex -module [module] -service [svc] -use [import/path/to/kitex_gen] [idl.thrift]
copy

SYNOPSIS

kitex [options] idlfile_

DESCRIPTION

kitex is a code generation tool for the Kitex high-performance RPC framework, part of ByteDance's open-source CloudWeGo ecosystem. It reads Thrift or Protocol Buffers interface definition language (IDL) files and generates Go scaffolding code for both servers and clients, including service interfaces, request/response types, serialization logic, and a runnable project skeleton.The generated code is designed for building Go microservices with features like connection pooling, load balancing, and circuit breaking built into the Kitex framework. By default, kitex produces both server and client code, but the `-client` flag restricts output to client stubs only. Custom code templates can be provided via the `-template` option to control the structure and style of the generated project.

PARAMETERS

IDLFILE_

Thrift or Protobuf IDL file.
-module NAME
Go module name.
-service NAME
Service name.
-I PATH
Add search path for IDL includes. Can be specified multiple times.
-use PATH
Skip generating kitex_gen and use the specified import path instead.
-v, -verbose
Output more logs during generation.
-type TYPE
Specify IDL type when it cannot be detected from the file extension.
-combine-service
Combine all services in the IDL into a single service (Thrift only).
-gen-path DIR
Specify output directory for generated code (default: kitex_gen).
-thrift VALUE
Pass an argument to the thriftgo compiler.
-protobuf VALUE
Pass an argument to the protoc compiler.

CAVEATS

Part of CloudWeGo. Go-specific. Thrift or Protobuf IDL required.

HISTORY

kitex is the code generator for Kitex, a high-performance RPC framework created by ByteDance.

SEE ALSO

thrift(1), protoc(1), go(1)

Copied to clipboard
Kai