{"id":51583559,"url":"https://github.com/sirkon/msgpack-go-gen","last_synced_at":"2026-07-11T08:04:02.718Z","repository":{"id":369298958,"uuid":"1288896523","full_name":"sirkon/msgpack-go-gen","owner":"sirkon","description":"Generator for msgpack serialization with the support for embed.","archived":false,"fork":false,"pushed_at":"2026-07-04T14:08:06.000Z","size":26,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"master","last_synced_at":"2026-07-04T16:05:05.947Z","etag":null,"topics":["code-generation","codegen","codegeneration","codegenerator","go","go-code-generator","golang","msgpack","msgpack-rpc"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/sirkon.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2026-07-04T05:04:32.000Z","updated_at":"2026-07-04T14:11:42.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/sirkon/msgpack-go-gen","commit_stats":null,"previous_names":["sirkon/msgpack-go-gen"],"tags_count":null,"template":false,"template_full_name":null,"purl":"pkg:github/sirkon/msgpack-go-gen","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sirkon%2Fmsgpack-go-gen","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sirkon%2Fmsgpack-go-gen/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sirkon%2Fmsgpack-go-gen/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sirkon%2Fmsgpack-go-gen/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/sirkon","download_url":"https://codeload.github.com/sirkon/msgpack-go-gen/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sirkon%2Fmsgpack-go-gen/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":35355128,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-07-11T02:00:05.354Z","response_time":104,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"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":["code-generation","codegen","codegeneration","codegenerator","go","go-code-generator","golang","msgpack","msgpack-rpc"],"created_at":"2026-07-11T08:04:02.091Z","updated_at":"2026-07-11T08:04:02.712Z","avatar_url":"https://github.com/sirkon.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# msgpack-go-gen\nGenerator for msgpack serialization with the support for manual embedding.\n\n## Installation\n\n```shell\ngo install github.com/sirkon/msgpack-go-gen\n```\n\n## What it is about.\n\nThere can be circumstances with whatever puprpose structures with mandatory fields. Something like\n\n```go\ntype Request struct {\n\tMandatory string `msgpack:\"mandatory\"`\n\t// The rest of fields.\n}\n```\n\nThe rest of fields could have been in their own payload structure of course, like\n\n```go\ntype Request[T any] struct {\n\tMandatory string `msgpack:\"mandatory\"`\n\tPayload   T      `msgpack:\"payload\"`\n}\n```\n\nBut, this is not always possible – there's a thing called \"loads of legacy code\", you know.\n\nAnd in Go, you can't just\n\n```go\ntype Request[T any] struct {\n\tMandatory string `msgpack:\"mandatory\"`\n\tT\n}\n```\n\nbecause it is explicitly forbidden. And neither [tinylib/msgp](https://github.com/tinylib/msgp), neither \n[vmihailenco/msgpack/vXXX](https://github/vmihailenco/msgpack/v5) support any kind of \"inline\" in tags\nto address this.\n\n## How this thing solves the issue.\n\nThis code generation solves this at the marshaling level. All you need is to:\n\n1. Define\n   ```go\n   func (p *Payload) alterFieldCount() int {\n       return 1 // How many additonal fields you want to append.\n   }\n   ```\n2. Generate `MarshalMsgPack` with this utilty.\n3. Write a function that appends that mandatory field:\n   ```go\n   func MarshalPayload(dst []byte, p *Payload, mandatory string) ([]byte, error) {\n       dst, err := p.MarshalMsgPack(p)\n       if err != nil {\n           return err\n       }\n   \n       dst = msgp.AppendString(\"mandatory\") // mgsp = github.com/tinylib/msgp/msgp\n       dst = msgp.AppendString(mandatory)\n   \n       return dst\n   }\n   ```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsirkon%2Fmsgpack-go-gen","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsirkon%2Fmsgpack-go-gen","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsirkon%2Fmsgpack-go-gen/lists"}