A Thrift encoding code generator and library for Go.
go get -u go.uber.org/thriftrw
If using Glide, at least
glide version 0.12 is required to install:
$ glide --version glide version 0.12.2 $ glide get 'go.uber.org/thriftrw#^1'
Development Status: Stable
Ready for most users. No breaking changes will be made within the same major release.
To install dependencies and build the project run:
To run the entire test suite, run:
A lot of the codebase has its logic exercised via integration tests residing in
In other words, since ThriftRW is a code generation library, the way to test that code generation behavior is
implemented correctly is to create a real Thrift struct definition, run code generation, and assert that the output is correct.
Step by step, this process is:
- Create or use a Thrift struct in
gen/internal/tests/thrift. For example, in
gen/internal/tests/thrift/structs.thrift, you can find
struct GoTagsthat is used to exercise go.tag generation behavior, or
struct NotOmitEmptythat is used to exercise behavior when a field is tagged with
make generate. This will generate the go struct from your definition, and place it in
- Write your test in one of the
*_test.gofiles that is pertinent to the feature you are adding. Oftentimes, these tests take in the generated go structs as inputs, and assert on various aspects of code generation like struct tags or json marshaling/unmarshaling behavior.
- Also remember to add your struct to
gen/quick_test.goso that your new struct and all of its generic methods (e.g., ToWire, FromWire, String, Equals, etc.) can be exercised for code coverage
Note: Code coverage is measured across packages, rather than per package. This is because
go test is run with the
which tells the code coverage tool to measure coverage for this package and all packages in the subdirectories.
There is no documentation for this package.
|ast||Package ast provides types and intefaces representing the abstract syntax tree for a single .thrift file.|
|compile||Package compile provides specifications for the types and services defined in a Thrift file.|
|gen||Package gen generates Go code based on a compiled Thrift module specification.|
|idl||Package idl provides a parser for Thrift IDL files.|
|internal/envelope/envelopetest||Package envelopetest is a generated GoMock package.|
|internal/frame||Package frame provides a framed reader and writer.|
|internal/plugin/builtin/pluginapigen||Package pluginapigen provides a plugin Handle that generates code used by the plugin system itself.|
|internal/plugin/handletest||Package handletest is a generated GoMock package.|
|plugin||Package plugin provides the API for writing ThriftRW plugins.|
|plugin/plugintest||Package plugintest is a generated GoMock package.|
|protocol||Package protocol provides implementations of different Thrift protocols.|
|protocol/binary||Package binary implements the Thrift Binary protocol.|
|ptr||Package ptr provides helpers to convert basic types to pointers.|
|thrifttest||Package thrifttest is a generated GoMock package.|
|wire||Package wire provides types and constants that map directly to the wire representation of Thrift values.|