Coder Social home page Coder Social logo

isgasho / thriftrw-go Goto Github PK

View Code? Open in Web Editor NEW

This project forked from thriftrw/thriftrw-go

0.0 1.0 0.0 2.66 MB

A Thrift encoding code generator and library for Go

License: MIT License

Go 94.47% Shell 0.04% Yacc 1.08% Makefile 0.40% Thrift 2.84% Python 0.26% Ragel 0.90%

thriftrw-go's Introduction

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.

thriftrw-go's People

Contributors

abhinav avatar r-hang avatar prashantv avatar bombela avatar syriebianco avatar allenluuber avatar bufdev avatar mh-park avatar kriskowal avatar robbertvanginkel avatar amckinney avatar raynos avatar recht avatar hellograyson avatar hlin117 avatar jacobgreenleaf avatar mattgode avatar ravirajj avatar jronak avatar styeung avatar alancastrouber avatar cl1337 avatar harshuber avatar orangerd avatar chuntaolu avatar felipefiali avatar dnathe4th avatar shirchen avatar daddye avatar dmtsui avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.