Skip to content

encoding/json: marshaling a zero value json.Marshaler interface struct field panics #16042

@advincze

Description

@advincze

Please answer these questions before submitting your issue. Thanks!

  1. What version of Go are you using (go version)?
    1.6
  2. What operating system and processor architecture are you using (go env)?
    darwin/amd6
  3. What did you do?
    https://play.golang.org/p/MsVP9u-We5
  4. What did you expect to see?
    {"M":null}
    https://golang.org/pkg/encoding/json/#Marshal says "A nil interface value encodes as the null JSON object."
  5. What did you see instead?
    panic: interface conversion: interface is nil, not json.Marshaler

Metadata

Metadata

Assignees

No one assigned

    Labels

    FrozenDueToAgeNeedsFixThe path to resolution is known, but the work has not been done.

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions