Suggestion: Parsing tags on nested structures
rusq opened this issue · 3 comments
rusq commented
Hi @BoRuDar , it's me again, your new friend.
Noticed that tags (on flag provider) are not being parsed on nested structure, so, say, on this structure:
type Config struct {
Client *Client `yaml:"client,omitempty" flag:"name|default_value|Description"`
Server *Server `yaml:"server,omitempty"`
}
type Client struct {
// ServerAddress is the default server address to connect to.
ServerAddress string `yaml:"default_server,omitempty" flag:"addr|127.0.0.1:443|server address"`
}
type Server struct {
// ...
}
only the tag for Client
will be parsed.
In my particular case the requirement is to have a config file that can include server and client configuration values, because executable can act as a client or server.
Would you agree that it would be very useful to transverse the nested structures too?
BoRuDar commented
Hi @rusq
Thank you for reporting. The lib is expected to parse embedded structs as well. I'll check it.
BoRuDar commented
Fixed in version v1.3.1
. Link to PR.
rusq commented
That was fast! Thank you :)