Skip to content

v2.1.0 time.Time decoding fix; remove unsafe, unmaintained code

Compare
Choose a tag to compare
@swenson swenson released this 09 Dec 21:55
· 3 commits to main since this release
c68e948

This release is primarily a cleanup release and to reduce the surface are of this library to just the safe variants of the msgpack and JSON codecs, and remove as much else as possible.

Included changes:

  • GH-13 Make time.Time decoding backwards compatible, and add full binary raft tests
    We are concerned with binary backwards compatibility for this
    project, especially as the upstream has a history of making breaking
    changes.

    With that in mind, I collected a bunch of data from
    https://github.com/hashicorp/raft for v0.5.5, v1.1.5, and v1.1.6
    of go-msgpack to ensure that, moving forward, we can always decode
    old raft logs.

    For the tests to pass, we have to support decoding time.Time
    using the encoding/binary marshalling format, which was used
    in certain v1.1.6.

    If users want to encode into the old binary marshalling time.Time format, it is still available with the codec.BasicHandle.TimeNotBuiltin option. Setting this option could help with migrating to the v2 versions.

  • GH-14 Remove fastpath and unsafe variants

  • GH-15 Use GitHub Actions instead of CircleCI

  • GH-16 Fix safe regression for non-addressable structs
    When we removed the default, unsafe mode, it caused a regression
    where we are no longer able to deserialize things like

    map[string]struct{A string}

    when we are deserializing into an already existing struct instance.
    This is because the struct in the map is not addressable by default,
    which caused a runtime panic. The previous unsafe version wrote
    directly to the underlying memory and bypassed this check

    We fix that by marking structs as an "immutable" type in the decoder,
    forcing it to recreate the struct rather than try to write to
    a non-addressable struct.

  • GH-17: Fix benchmarks; delete cbor, simple, binc (#17)

    • Fixed all of the benchmark code to work again.
    • Updated documentation with correct package paths
    • Deleted protocols we don't need
      cbor
      • simple
      • binc
    • Removed a bunch of workarounds for old Go versions
    • Removed some redundant documentation