{"id":37094864,"url":"https://github.com/viciious/msgp","last_synced_at":"2026-01-14T11:40:41.096Z","repository":{"id":57593645,"uuid":"125209474","full_name":"viciious/msgp","owner":"viciious","description":"A Go code generator for MessagePack / msgpack.org[Go]","archived":false,"fork":true,"pushed_at":"2018-02-15T04:25:08.000Z","size":9978,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2024-06-20T06:25:42.416Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":false,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":"tinylib/msgp","license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/viciious.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2018-03-14T12:32:08.000Z","updated_at":"2018-03-14T12:32:10.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/viciious/msgp","commit_stats":null,"previous_names":[],"tags_count":6,"template":false,"template_full_name":null,"purl":"pkg:github/viciious/msgp","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/viciious%2Fmsgp","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/viciious%2Fmsgp/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/viciious%2Fmsgp/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/viciious%2Fmsgp/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/viciious","download_url":"https://codeload.github.com/viciious/msgp/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/viciious%2Fmsgp/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28419242,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-14T10:47:48.104Z","status":"ssl_error","status_checked_at":"2026-01-14T10:46:19.031Z","response_time":107,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2026-01-14T11:40:40.294Z","updated_at":"2026-01-14T11:40:41.071Z","avatar_url":"https://github.com/viciious.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"MessagePack Code Generator [![Build Status](https://travis-ci.org/tinylib/msgp.svg?branch=master)](https://travis-ci.org/tinylib/msgp)\n=======\n\nThis is a code generation tool and serialization library for [MessagePack](http://msgpack.org). You can read more about MessagePack [in the wiki](http://github.com/tinylib/msgp/wiki), or at [msgpack.org](http://msgpack.org).\n\n### Why?\n\n- Use Go as your schema language\n- Performance\n- [JSON interop](http://godoc.org/github.com/tinylib/msgp/msgp#CopyToJSON)\n- [User-defined extensions](http://github.com/tinylib/msgp/wiki/Using-Extensions)\n- Type safety\n- Encoding flexibility\n\n### Quickstart\n\nIn a source file, include the following directive:\n\n```go\n//go:generate msgp\n```\n\nThe `msgp` command will generate serialization methods for all exported type declarations in the file.\n\nYou can [read more about the code generation options here](http://github.com/tinylib/msgp/wiki/Using-the-Code-Generator).\n\n### Use\n\nField names can be set in much the same way as the `encoding/json` package. For example:\n\n```go\ntype Person struct {\n\tName       string `msg:\"name\"`\n\tAddress    string `msg:\"address\"`\n\tAge        int    `msg:\"age\"`\n\tHidden     string `msg:\"-\"` // this field is ignored\n\tunexported bool             // this field is also ignored\n}\n```\n\nBy default, the code generator will satisfy `msgp.Sizer`, `msgp.Encodable`, `msgp.Decodable`, \n`msgp.Marshaler`, and `msgp.Unmarshaler`. Carefully-designed applications can use these methods to do\nmarshalling/unmarshalling with zero heap allocations.\n\nWhile `msgp.Marshaler` and `msgp.Unmarshaler` are quite similar to the standard library's\n`json.Marshaler` and `json.Unmarshaler`, `msgp.Encodable` and `msgp.Decodable` are useful for \nstream serialization. (`*msgp.Writer` and `*msgp.Reader` are essentially protocol-aware versions\nof `*bufio.Writer` and `*bufio.Reader`, respectively.)\n\n### Features\n\n - Extremely fast generated code\n - Test and benchmark generation\n - JSON interoperability (see `msgp.CopyToJSON() and msgp.UnmarshalAsJSON()`)\n - Support for complex type declarations\n - Native support for Go's `time.Time`, `complex64`, and `complex128` types \n - Generation of both `[]byte`-oriented and `io.Reader/io.Writer`-oriented methods\n - Support for arbitrary type system extensions\n - [Preprocessor directives](http://github.com/tinylib/msgp/wiki/Preprocessor-Directives)\n - File-based dependency model means fast codegen regardless of source tree size.\n\nConsider the following:\n```go\nconst Eight = 8\ntype MyInt int\ntype Data []byte\n\ntype Struct struct {\n\tWhich  map[string]*MyInt `msg:\"which\"`\n\tOther  Data              `msg:\"other\"`\n\tNums   [Eight]float64    `msg:\"nums\"`\n}\n```\nAs long as the declarations of `MyInt` and `Data` are in the same file as `Struct`, the parser will determine that the type information for `MyInt` and `Data` can be passed into the definition of `Struct` before its methods are generated.\n\n#### Extensions\n\nMessagePack supports defining your own types through \"extensions,\" which are just a tuple of\nthe data \"type\" (`int8`) and the raw binary. You [can see a worked example in the wiki.](http://github.com/tinylib/msgp/wiki/Using-Extensions)\n\n### Status\n\nMostly stable, in that no breaking changes have been made to the `/msgp` library in more than a year. Newer versions\nof the code may generate different code than older versions for performance reasons. I (@philhofer) am aware of a\nnumber of stability-critical commercial applications that use this code with good results. But, caveat emptor.\n\nYou can read more about how `msgp` maps MessagePack types onto Go types [in the wiki](http://github.com/tinylib/msgp/wiki).\n\nHere some of the known limitations/restrictions:\n\n- Identifiers from outside the processed source file are assumed (optimistically) to satisfy the generator's interfaces. If this isn't the case, your code will fail to compile.\n- Like most serializers, `chan` and `func` fields are ignored, as well as non-exported fields.\n- Encoding of `interface{}` is limited to built-ins or types that have explicit encoding methods.\n- _Maps must have `string` keys._ This is intentional (as it preserves JSON interop.) Although non-string map keys are not forbidden by the MessagePack standard, many serializers impose this restriction. (It also means *any* well-formed `struct` can be de-serialized into a `map[string]interface{}`.) The only exception to this rule is that the deserializers will allow you to read map keys encoded as `bin` types, due to the fact that some legacy encodings permitted this. (However, those values will still be cast to Go `string`s, and they will be converted to `str` types when re-encoded. It is the responsibility of the user to ensure that map keys are UTF-8 safe in this case.) The same rules hold true for JSON translation.\n\nIf the output compiles, then there's a pretty good chance things are fine. (Plus, we generate tests for you.) *Please, please, please* file an issue if you think the generator is writing broken code.\n\n### Performance\n\nIf you like benchmarks, see [here](http://bravenewgeek.com/so-you-wanna-go-fast/) and [here](https://github.com/alecthomas/go_serialization_benchmarks).\n\nAs one might expect, the generated methods that deal with `[]byte` are faster for small objects, but the `io.Reader/Writer` methods are generally more memory-efficient (and, at some point, faster) for large (\u003e 2KB) objects.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fviciious%2Fmsgp","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fviciious%2Fmsgp","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fviciious%2Fmsgp/lists"}