Files
nomad/vendor/github.com/vmihailenco/msgpack
Seth Hoenig 15fb4c990a deps: Switch to Go modules for dependency management
This PR switches the Nomad repository from using govendor to Go modules
for managing dependencies. Aspects of the Nomad workflow remain pretty
much the same. The usual Makefile targets should continue to work as
they always did. The API submodule simply defers to the parent Nomad
version on the repository, keeping the semantics of API versioning that
currently exists.
2020-06-02 14:30:36 -05:00
..
2018-08-12 15:58:39 -07:00
2018-08-12 15:58:39 -07:00
2018-08-12 15:58:39 -07:00
2018-08-12 15:58:39 -07:00
2018-08-12 15:58:39 -07:00
2018-08-12 15:58:39 -07:00
2018-08-12 15:58:39 -07:00
2018-08-12 15:58:39 -07:00
2018-08-12 15:58:39 -07:00
2018-08-12 15:58:39 -07:00
2018-08-12 15:58:39 -07:00
2018-08-12 15:58:39 -07:00
2018-08-12 15:58:39 -07:00
2018-08-12 15:58:39 -07:00
2018-08-12 15:58:39 -07:00
2018-08-12 15:58:39 -07:00
2018-08-12 15:58:39 -07:00
2018-08-12 15:58:39 -07:00
2018-08-12 15:58:39 -07:00
2018-08-12 15:58:39 -07:00
2018-08-12 15:58:39 -07:00
2018-08-12 15:58:39 -07:00

MessagePack encoding for Golang

Build Status GoDoc

Supports:

API docs: https://godoc.org/github.com/vmihailenco/msgpack. Examples: https://godoc.org/github.com/vmihailenco/msgpack#pkg-examples.

Installation

Install:

go get -u github.com/vmihailenco/msgpack

Quickstart

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
}

Benchmark

BenchmarkStructVmihailencoMsgpack-4   	  200000	     12814 ns/op	    2128 B/op	      26 allocs/op
BenchmarkStructUgorjiGoMsgpack-4      	  100000	     17678 ns/op	    3616 B/op	      70 allocs/op
BenchmarkStructUgorjiGoCodec-4        	  100000	     19053 ns/op	    7346 B/op	      23 allocs/op
BenchmarkStructJSON-4                 	   20000	     69438 ns/op	    7864 B/op	      26 allocs/op
BenchmarkStructGOB-4                  	   10000	    104331 ns/op	   14664 B/op	     278 allocs/op

Howto

Please go through examples to get an idea how to use this package.

See also