thriftrw

command module
v1.31.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 9, 2023 License: MIT Imports: 14 Imported by: 0

README

thriftrw-go GoDoc Build Status Coverage Status

A Thrift encoding code generator and library for Go.

Installation

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.

Development

To install dependencies and build the project run:

make build
Testing

To run the entire test suite, run:

make test
Integration tests

A lot of the codebase has its logic exercised via integration tests residing in gen/internal/tests. 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:

  1. Create or use a Thrift struct in gen/internal/tests/thrift. For example, in gen/internal/tests/thrift/structs.thrift, you can find struct GoTags that is used to exercise go.tag generation behavior, or struct NotOmitEmpty that is used to exercise behavior when a field is tagged with !omitempty
  2. Run make generate. This will generate the go struct from your definition, and place it in gen/internal/tests/structs/structs.go
  3. Write your test in one of the *_test.go files 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.
  4. Also remember to add your struct to gen/quick_test.go so 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 -coverpkg=./... flag, which tells the code coverage tool to measure coverage for this package and all packages in the subdirectories.

Documentation

The Go Gopher

There is no documentation for this package.

Directories

Path Synopsis
Package ast provides types and intefaces representing the abstract syntax tree for a single .thrift file.
Package ast provides types and intefaces representing the abstract syntax tree for a single .thrift file.
cmd
Package compile provides specifications for the types and services defined in a Thrift file.
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.
Package gen generates Go code based on a compiled Thrift module specification.
idl
Package idl provides a parser for Thrift IDL files.
Package idl provides a parser for Thrift IDL files.
internal
envelope/envelopetest
Package envelopetest is a generated GoMock package.
Package envelopetest is a generated GoMock package.
frame
Package frame provides a framed reader and writer.
Package frame provides a framed reader and writer.
git
plugin/builtin/pluginapigen
Package pluginapigen provides a plugin Handle that generates code used by the plugin system itself.
Package pluginapigen provides a plugin Handle that generates code used by the plugin system itself.
plugin/handletest
Package handletest is a generated GoMock package.
Package handletest is a generated GoMock package.
Package plugin provides the API for writing ThriftRW plugins.
Package plugin provides the API for writing ThriftRW plugins.
api
plugintest
Package plugintest is a generated GoMock package.
Package plugintest is a generated GoMock package.
Package protocol provides implementations of different Thrift protocols.
Package protocol provides implementations of different Thrift protocols.
binary
Package binary implements the Thrift Binary protocol.
Package binary implements the Thrift Binary protocol.
stream
Package stream provides streaming implementations of encoding and decoding Thrift values.
Package stream provides streaming implementations of encoding and decoding Thrift values.
Package ptr provides helpers to convert basic types to pointers.
Package ptr provides helpers to convert basic types to pointers.
Package thrifttest is a generated GoMock package.
Package thrifttest is a generated GoMock package.
streamtest
Package streamtest is a generated GoMock package.
Package streamtest is a generated GoMock package.
Package wire provides types and constants that map directly to the wire representation of Thrift values.
Package wire provides types and constants that map directly to the wire representation of Thrift values.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL