Skip to content

Commit

Permalink
optimize Traverse to avoid fixing the option name twice
Browse files Browse the repository at this point in the history
  • Loading branch information
xgfone committed Aug 24, 2019
1 parent 3e5c7ca commit d0e6b91
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion config.go
Original file line number Diff line number Diff line change
Expand Up @@ -337,7 +337,8 @@ func (c *Config) PrintGroup(w io.Writer) error {
func (c *Config) Traverse(f func(group string, opt string, value interface{})) {
for _, group := range c.AllGroups() {
for _, opt := range group.AllOpts() {
f(group.Name(), group.fixOptName(opt.Name), group.Get(opt.Name))
name := group.fixOptName(opt.Name)
f(group.Name(), name, group.Get(name))
}
}
}
Expand Down

0 comments on commit d0e6b91

Please sign in to comment.