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"`
}
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