Skip to content

Conversation

@justmao945
Copy link

Consider the following embedded struct:

type Test struct {
  Embed struct {
    Name string `json:"name"`
  }
}

@cee-dub
Copy link
Collaborator

cee-dub commented Jul 30, 2015

Could you add a test case to illustrate the change in output?

@justmao945
Copy link
Author

OK, I added a test case.

If use t.String() to print the type, you'll get

&pretty.Embedded{
            Foo: "foo",
            Bar: struct { A int "json:\"a\""; B float64 "json:\"b\""; C string "json:\"c\"" }{A:1, B:1.1, C:"bar"},
}

I don't think it is a pretty print, so I only print struct for embedded struct which has empty type Name().

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