https://github.com/cloudwego/thriftgo
An implementation of thrift compiler in go language.
https://github.com/cloudwego/thriftgo
golang idl thrift
Last synced: about 1 month ago
JSON representation
An implementation of thrift compiler in go language.
- Host: GitHub
- URL: https://github.com/cloudwego/thriftgo
- Owner: cloudwego
- License: apache-2.0
- Created: 2021-02-25T07:27:02.000Z (over 4 years ago)
- Default Branch: main
- Last Pushed: 2025-05-14T03:51:51.000Z (about 1 month ago)
- Last Synced: 2025-05-14T04:56:11.332Z (about 1 month ago)
- Topics: golang, idl, thrift
- Language: Go
- Homepage:
- Size: 1.07 MB
- Stars: 279
- Watchers: 14
- Forks: 85
- Open Issues: 6
-
Metadata Files:
- Readme: README.md
- Contributing: CONTRIBUTING.md
- License: LICENSE
- Codeowners: .github/CODEOWNERS
Awesome Lists containing this project
README
# Thriftgo
English | [中文](README_cn.md) | [日本語](README_ja.md)
**Thriftgo** is an implementation of [thrift](https://thrift.apache.org/docs/idl) 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:
```shell
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:
```shell
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.