Skip to content

Instantly share code, notes, and snippets.

@philandstuff
Last active June 2, 2019 20:25
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save philandstuff/21e48af16694be81799ae516a6d92fec to your computer and use it in GitHub Desktop.
Save philandstuff/21e48af16694be81799ae516a6d92fec to your computer and use it in GitHub Desktop.
Demonstration of ugorji/go#300
package main
import (
"fmt"
"log"
"github.com/ugorji/go/codec"
)
func main() {
var h codec.CborHandle
h.SkipUnexpectedTags = true
toDecode := []byte{0xd9, 0xd9, 0xf7, 0x82, 0x61, 0x78, 0x00}
var raw interface{}
dec := codec.NewDecoderBytes(toDecode, &h)
err := dec.Decode(&raw)
if err != nil {
log.Fatal(err)
}
fmt.Printf("Got %#v from decoding", raw)
}
module gist.github.com/philandstuff/21e48af16694be81799ae516a6d92fec
go 1.12
require github.com/ugorji/go v1.1.5-0.20190602185654-b7b8e1c6cca2
github.com/ugorji/go v1.1.5-0.20190602185654-b7b8e1c6cca2 h1:cq6ggwrtxk5VEWTVWlyl4E0XcOALX/DT3UcPtxX/MLk=
github.com/ugorji/go v1.1.5-0.20190602185654-b7b8e1c6cca2/go.mod h1:RaaajvHwnCbhlqWLTIB78hyPWp24YUXhQ3YXM7Hg7os=
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment