Giter Site home page Giter Site logo

msgpgen's Introduction

msgpgen - Alternative code generator wrapper for msgp

Note: This badly needed a lick of paint before Go Modules came onto the scene, and should now be considered obsolete/unmaintained. Having said that, if you depend on this and you run into trouble with it, please open an issue and I'll see if I can help.


msgpgen combines tinylib/msgp with shabbyrobe/structer to solve a few issues with the code generating portion of tinylib/msgp.

It supports:

  • All the same arguments as the old generator

It differs:

  • ignore and shim directives must be declared using the full package path.

It adds:

  • Support for non-local identifiers, by simply generating the code for those identifiers in the relevant package.
  • Automatic shimming of primitives
  • Automatic handling of interface types
  • Silencing spurious warnings
  • Alternative methods of searching for types, including using a flat file containing a whitelist, or searching for all types that implement an interface.

It has the following issues (which should all be fixed at some point):

  • Import recursion is not limited. msgpgen will blindly traverse any user package it finds in your gopath and will generate code into it.
  • Ignored fields (with the tag msg:"-") produce a warning in the output which is not currently quashed.

We may be able to support:

  • #163 Embedded fields behaviour

It solves the following issues in the msgp tracker:

  • #183 Generator output severity labels
  • #158 Workaround for types that are defined in another package?
  • #141 Directive ignore all
  • #128 Best effort warnings re: external types
  • #47 Keep track of imports (boy does it ever do that)

Using

To generate msgpack for all types in and under mypkg that implement interface mypkg.Msg, then recursively generate all types in other packages in your GOPATH that those types reference, use the following:

//go:generate msgpgen -iface mypkg.Msg -import mypkg/...

Warning

The recursion is not currenty limited by the -import flag, though it will be.

msgpgen's People

Contributors

shabbyrobe avatar

Watchers

 avatar  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.