Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Do not attempt to set unsettable types #7

Merged
merged 1 commit into from
Apr 18, 2019
Merged

Conversation

mkeeler
Copy link
Member

@mkeeler mkeeler commented Apr 18, 2019

Previously the following would fail:

package main

import (
   "github.com/hashicorp/go-msgpack/codec"
)

type WithMap struct {
   Map map[string]string
}

func main() {
   x := WithMap{Map: map[string]string{"foo": "bar"}}
   y := WithMap{Map: map[string]string{"foo": "baz"}}

   var buf []byte
   hnd := codec.MsgpackHandle{}
   enc := codec.NewEncoderBytes(&buf, &hnd)

   err := enc.Encode(x)
   if err != nil {
      panic(err)
   }

   dec := codec.NewDecoderBytes(buf, &hnd)
   err = dec.Decode(&y)
   if err != nil {
      panic(err)
   }
}

This PR fixes that.

@mkeeler mkeeler merged commit c4a1f61 into master Apr 18, 2019
@mkeeler mkeeler deleted the re-decode-map-value branch April 18, 2019 18:47
thaJeztah added a commit to thaJeztah/libnetwork that referenced this pull request Aug 26, 2019
full diff: hashicorp/go-msgpack@71c2886...v0.5.5

- hashicorp/go-msgpack#3 Add go.mod
- hashicorp/go-msgpack#7 Do not attempt to set unsettable types
- hashicorp/go-msgpack#8 codec: do not dereference pointers/interfaces for omitempty support
  - backport of hashicorp/go-msgpack@006e153
  - backport of hashicorp/go-msgpack@006e153
  - fixes ugorji/go#67 "omitempty" fails on pointers to bools

Signed-off-by: Sebastiaan van Stijn <[email protected]>
thaJeztah added a commit to thaJeztah/libnetwork that referenced this pull request Aug 26, 2019
full diff: hashicorp/go-msgpack@71c2886...v0.5.5

- hashicorp/go-msgpack#3 Add go.mod
- hashicorp/go-msgpack#7 Do not attempt to set unsettable types
- hashicorp/go-msgpack#8 codec: do not dereference pointers/interfaces for omitempty support
  - backport of hashicorp/go-msgpack@006e153
  - backport of hashicorp/go-msgpack@006e153
  - fixes ugorji/go#67 "omitempty" fails on pointers to bools

Signed-off-by: Sebastiaan van Stijn <[email protected]>
thaJeztah added a commit to thaJeztah/libnetwork that referenced this pull request Aug 26, 2019
full diff: hashicorp/go-msgpack@71c2886...v0.5.5

- hashicorp/go-msgpack#3 Add go.mod
- hashicorp/go-msgpack#7 Do not attempt to set unsettable types
- hashicorp/go-msgpack#8 codec: do not dereference pointers/interfaces for omitempty support
  - backport of hashicorp/go-msgpack@006e153
  - backport of hashicorp/go-msgpack@006e153
  - fixes ugorji/go#67 "omitempty" fails on pointers to bools

Signed-off-by: Sebastiaan van Stijn <[email protected]>
thaJeztah added a commit to thaJeztah/libnetwork that referenced this pull request Feb 26, 2020
full diff: hashicorp/go-msgpack@71c2886...v0.5.5

- hashicorp/go-msgpack#3 Add go.mod
- hashicorp/go-msgpack#7 Do not attempt to set unsettable types
- hashicorp/go-msgpack#8 codec: do not dereference pointers/interfaces for omitempty support
  - backport of hashicorp/go-msgpack@006e153
  - backport of hashicorp/go-msgpack@006e153
  - fixes ugorji/go#67 "omitempty" fails on pointers to bools

Signed-off-by: Sebastiaan van Stijn <[email protected]>
thaJeztah added a commit to thaJeztah/libnetwork that referenced this pull request May 11, 2021
full diff: hashicorp/go-msgpack@71c2886...v0.5.5

- hashicorp/go-msgpack#3 Add go.mod
- hashicorp/go-msgpack#7 Do not attempt to set unsettable types
- hashicorp/go-msgpack#8 codec: do not dereference pointers/interfaces for omitempty support
  - backport of hashicorp/go-msgpack@006e153
  - backport of hashicorp/go-msgpack@006e153
  - fixes ugorji/go#67 "omitempty" fails on pointers to bools

Signed-off-by: Sebastiaan van Stijn <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants