Skip to content

An implementation of thrift compiler in go language.

License

Notifications You must be signed in to change notification settings

cloudwego/thriftgo

Folders and files

NameName
Last commit message
Last commit date

Latest commit

8ef39cd · Mar 20, 2025
Mar 4, 2025
Oct 22, 2024
Jun 12, 2024
Mar 9, 2022
Aug 7, 2024
Apr 26, 2024
Mar 11, 2025
Dec 5, 2023
Jun 19, 2024
Aug 30, 2022
May 23, 2024
Oct 22, 2024
May 31, 2024
Oct 30, 2024
Dec 26, 2024
Mar 20, 2025
Feb 8, 2025
Mar 19, 2025
Feb 19, 2025
Nov 21, 2023
May 16, 2022
Jun 1, 2021
Nov 21, 2023
Feb 25, 2021
Oct 29, 2024
Jul 23, 2024
Jul 23, 2024
Jul 23, 2024
May 16, 2022
Aug 7, 2024
Aug 7, 2024
Aug 5, 2024
May 16, 2022

Repository files navigation

Thriftgo

English | 中文 | 日本語

Thriftgo is an implementation of thrift compiler in go language. It has a command line interface similar to the apache/thrift compiler and is enhanced with a plugin mechanism which makes it more powerful.

Installation

Note: before executing the following commands, make sure your GOPATH environment is properly set.

Using go install:

GO111MODULE=on go install github.com/cloudwego/thriftgo@latest

Or build from source:

git clone https://github.com/cloudwego/thriftgo.git
cd thriftgo
export GO111MODULE=on
go mod tidy
go build
go install

Usage

The Thriftgo command line tool accepts IDL files and compiles them to the target language. Each backend has a plentiful set of options to customize the generated code.

By the moment, Thriftgo can generates golang code only. More backends will be added in the future.

To compile an thrift IDL to golang files with the default setting, you can just run:

thriftgo -g go the-idl-file.thrift

Run thriftgo -h to see all available options for each backend and their meanings.

Plugin

If the code generated by Thriftgo does not satisfy your needs and the options provideds do not meet your requirements. You may also write plugins to generate code beside Thriftgo while taking the advantage of Thriftgo's IDL parser. Check the documentation of the plugin package for more details.