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

Interface Field Support #4

Open
avivcarmis opened this issue Aug 8, 2022 · 0 comments
Open

Interface Field Support #4

avivcarmis opened this issue Aug 8, 2022 · 0 comments

Comments

@avivcarmis
Copy link
Contributor

Since getters are not idiomatic Go when there's no functional requirement, creating getter functions simply to allow interface to match structs does feel idiomatic. This use case only gets less idiomatic when the getter-ed fields need to be public on their own to support reflection like in the case of json unmarshaled fields.

How about interface field support

type User interface {
  Name string
}

type user struct {
  Name string `json:"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

No branches or pull requests

1 participant