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

unnecessary wrapping #308

Open
artvel opened this issue May 19, 2022 · 2 comments
Open

unnecessary wrapping #308

artvel opened this issue May 19, 2022 · 2 comments

Comments

@artvel
Copy link

artvel commented May 19, 2022

Having a structure like:

type A struct {
 Field1 int
 Field2 string
}
type B struct {
 A
}

Produces currently an unnecessary wrapped outcome:

B.A.Field1
B.A.Field2

Expected outcome:

B.Field1
B.Field2
@photoszzt
Copy link

there's a flatten tag which implements this behavior.

type B struct {
A `msg",flatten"
}

But it seems it only works if A and B is in the same file. This breaks if it's in a different file. Worse, it doesn't print any warning that it skips a field during generation.

@klauspost
Copy link
Collaborator

Is there any actual problems arising from this?

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

No branches or pull requests

3 participants