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 print definition for embedded struct #24

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

don't print definition for embedded struct #24

wants to merge 1 commit into from

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.

None yet

2 participants