a69 / msgpack

msgpack.org[Go] MessagePack encoding for Golang

Home Page:https://msgpack.uptrace.dev/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

MessagePack encoding for Golang

Build Status PkgGoDev Documentation Chat

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

Resources

Features

Installation

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

go mod init github.com/my/repo

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

go get github.com/vmihailenco/msgpack/v5

Quickstart

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

Contributors

Thanks to all the people who already contributed!

About

msgpack.org[Go] MessagePack encoding for Golang

https://msgpack.uptrace.dev/

License:BSD 2-Clause "Simplified" License


Languages

Language:Go 99.9%Language:Makefile 0.1%Language:JavaScript 0.0%