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

Can you embed structs from different packages? #271

Open
maxless opened this issue Apr 7, 2020 · 0 comments
Open

Can you embed structs from different packages? #271

maxless opened this issue Apr 7, 2020 · 0 comments

Comments

@maxless
Copy link

maxless commented Apr 7, 2020

I have structs defined in a different package that are referenced from the main one. In this case msgpack generator ignores them, stating so:

main_test.go: TestRequest: service.RequestHeader: ignored.

Service package:

package service

type RequestHeader struct {
   FieldA int `msg:"fielda"`
}

main package:

type TestRequest struct {
  service.RequestHeader `msg:",flatten"`
  Data struct {
      Test int `msg:"test"`
  } `msg:"data"`
}

If flatten tag is commented out, the message is different:

main_test.go: TestRequest: unresolved identifier: service.RequestHeader
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

1 participant