Baike.dev
All toolsOnline toolsAI codingTrendingOpen sourceNewsSubmit
Log in
< Back to tools
M

msgpack

> 编程语言
Open source

msgpack.org[Go] MessagePack encoding for Golang

2.7K stars0 likes2 views
WebsiteGitHub

About

msgpack.org[Go] MessagePack encoding for Golang

MessagePack encoding for Golang

msgpack is brought to you by :star: uptrace/uptrace. Uptrace is an open source APM and blazingly fast distributed tracing tool powered by OpenTelemetry and ClickHouse. Give it a star as well!

Resources

  • Documentation
  • Chat
  • Reference
  • Examples

Features

  • Primitives, arrays, maps, structs, time.Time and interface{}.
  • Appengine *datastore.Key and datastore.Cursor.
  • CustomEncoder/CustomDecoder interfaces for custom encoding.
  • Extensions to encode type information.
  • Renaming fields via msgpack:"my_field_name" and alias via msgpack:"alias:another_name".
  • Omitting individual empty fields via msgpack:",omitempty" tag or all empty fields in a struct.
  • Map keys sorting.
  • Encoding/decoding all structs as arrays or individual structs.
  • Encoder.SetCustomStructTag with Decoder.SetCustomStructTag can turn msgpack into drop-in replacement for any tag.
  • Simple but very fast and efficient queries.

Installation

msgpack supports 2 last Go versions and requires support for Go modules. So make sure to initialize a Go module:

bash
go mod init github.com/my/repo

And then install msgpack/v5 (note v5 in the import; omitting it is a popular mistake):

bash
go get github.com/vmihailenco/msgpack/v5

Quickstart

go
import "github.com/vmihailenco/msgpack/v5"

func ExampleMarshal() {
    type Item struct {
        Foo string
    }

    b, err := msgpack.Marshal(&Item{Foo: "bar"})
    if err != nil {
        panic(err)
    }

    var item Item
    err = msgpack.Unmarshal(b, &item)
    if err != nil {
        panic(err)
    }
    fmt.Println(item.Foo)
    // Output: bar
}

See also

  • Golang ORM for PostgreSQL, MySQL, MSSQL, and SQLite
  • Golang PostgreSQL
  • Golang HTTP router
  • Golang ClickHouse ORM

Contributors

Thanks to all the people who already contributed!

Issues· 0 open

View all issuesOpen on GitHub

No open issues yet, or sync has not completed.

> Tags

Goencodinggogolangmsgpack

No comments yet. Be the first to share.

> Details

PublishedAug 1, 2026
UpdatedSep 17, 2026
Category编程语言
PricingOpen source

> Related tools

T
TypeScript
JavaScript 的超集,为前端与全栈提供静态类型
P
Python
通用编程语言,广泛用于 Web、数据与 AI
G
Go
Google 推出的简洁高效系统语言