fix go1.6 compatibility problem in tests#172
Merged
pquerna merged 1 commit intopquerna:masterfrom Apr 7, 2016
Merged
Conversation
https://tip.golang.org/doc/go1.6 The reflect package has resolved a long-standing incompatibility between the gc and gccgo toolchains regarding embedded unexported struct types containing exported fields. Code that walks data structures using reflection, especially to implement serialization in the spirit of the encoding/json and encoding/xml packages, may need to be updated. The problem arises when using reflection to walk through an embedded unexported struct-typed field into an exported field of that struct. In this case, reflect had incorrectly reported the embedded field as exported, by returning an empty Field.PkgPath. Now it correctly reports the field as unexported but ignores that fact when evaluating access to exported fields contained within the struct. Updating: Typically, code that previously walked over structs and used f.PkgPath != "" to exclude inaccessible fields should now use f.PkgPath != "" && !f.Anonymous For example, see the changes to the implementations of encoding/json and encoding/xml. Also see code for more details
Author
|
i just realized that the problem might be deeper than I thought. If you want to keep compatibility with encode/json you would need to changes ffjson's behavior. |
Owner
|
yes, keeping the behavior the same as encoding/json is a goal -- I started playing with respecting |
This was referenced Mar 30, 2016
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
https://tip.golang.org/doc/go1.6
The reflect package has resolved a long-standing incompatibility between
the gc and gccgo toolchains regarding embedded unexported struct types
containing exported fields. Code that walks data structures using
reflection, especially to implement serialization in the spirit of the
encoding/json and encoding/xml packages, may need to be updated.
The problem arises when using reflection to walk through an embedded
unexported struct-typed field into an exported field of that struct. In
this case, reflect had incorrectly reported the embedded field as exported,
by returning an empty Field.PkgPath. Now it correctly reports the field as
unexported but ignores that fact when evaluating access to exported fields
contained within the struct.
Updating: Typically, code that previously walked over structs and used
f.PkgPath != ""
to exclude inaccessible fields should now use
f.PkgPath != "" && !f.Anonymous
For example, see the changes to the implementations of encoding/json and
encoding/xml.
Also see code for more details