Merge lp:~rogpeppe/goyaml/goyaml-omit-zero-pointers into lp:~gophers/goyaml/trunk

Proposed by Roger Peppe
Status: Merged
Merged at revision: 30
Proposed branch: lp:~rogpeppe/goyaml/goyaml-omit-zero-pointers
Merge into: lp:~gophers/goyaml/trunk
Diff against target: 0 lines
To merge this branch: bzr merge lp:~rogpeppe/goyaml/goyaml-omit-zero-pointers
Reviewer Review Type Date Requested Status
The Go Language Gophers Pending
Review via email: mp+83603@code.launchpad.net

Description of the change

goyaml: omit zero-value pointers

The documentation does not explicitly mention pointers
when marshalling, but it seems within the spirit of the
documentation that nil pointers should not be marshalled
when the omitzero tag is set.

This enables struct values to be omitted from the output if desired.

https://codereview.appspot.com/5431087/

To post a comment you must log in.
Revision history for this message
Gustavo Niemeyer (niemeyer) wrote :

Nice, LGTM

https://codereview.appspot.com/5431087/diff/1/goyaml.go
File goyaml.go (right):

https://codereview.appspot.com/5431087/diff/1/goyaml.go#newcode266
goyaml.go:266: return v.IsNil()
You can join this to the above Interface case:

     case reflect.Ptr, reflect.Interface:
         ...

https://codereview.appspot.com/5431087/

30. By Roger Peppe

merged switch cases.

Revision history for this message
Roger Peppe (rogpeppe) wrote :

On 28 November 2011 13:18, <email address hidden> wrote:
> https://codereview.appspot.com/5431087/diff/1/goyaml.go#newcode266
> goyaml.go:266: return v.IsNil()
> You can join this to the above Interface case:
>
>    case reflect.Ptr, reflect.Interface:
>        ...

done.

submitted.

Preview Diff

Empty

Subscribers

People subscribed via source and target branches