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

don't panic when trying to check for required fields #510

Merged
merged 3 commits into from
Feb 3, 2018

Conversation

jhump
Copy link
Contributor

@jhump jhump commented Feb 2, 2018

As mentioned in #509, jsonpb panics when marshaling/unmarshaling a non-generated message that has an unexported pointer field. This change will restore dynamic messages to working with jsonpb (they work fine in master; just broken in this dev branch as of #472).

@paranoiacblack
Copy link
Contributor

This looks fine to me. Deferring to @dsnet

@jhump jhump changed the title allow messages to provide their own validation implementation don't panic when trying to check for required fields Feb 3, 2018
jsonpb/jsonpb.go Outdated
exported = unicode.IsUpper(r)
break
}
if !exported {
Copy link
Member

@dsnet dsnet Feb 3, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if exported := sfield.PkgPath == ""; !exported {
    continue
}

@dsnet dsnet merged commit 42d4f47 into golang:dev Feb 3, 2018
@golang golang locked and limited conversation to collaborators Jun 26, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants