Skip to content

Commit

Permalink
Lint..
Browse files Browse the repository at this point in the history
  • Loading branch information
Alexandr Samylkin committed Apr 11, 2017
1 parent 2d6831a commit 65793b2
Showing 1 changed file with 5 additions and 8 deletions.
13 changes: 5 additions & 8 deletions config/command_line_provider.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,18 +32,19 @@ type StringSlice []string

var _ flag.Value = (*StringSlice)(nil)

// String returns slice elements separated by comma.
func (s *StringSlice) String() string {
return strings.Join(*s, ",")
}

// Set splits val using comma as separators.
func (s *StringSlice) Set(val string) error {
*s = StringSlice(strings.Split(val, ","))
return nil
}

type commandLineProvider struct {
p Provider
NopProvider
Provider
}

// NewCommandLineProvider returns a Provider that is using command line parameters as config values.
Expand All @@ -60,7 +61,7 @@ func NewCommandLineProvider(flags *flag.FlagSet, args []string) Provider {
assignValues(prev, last, f.Value)
})

return &commandLineProvider{p: NewStaticProvider(m)}
return commandLineProvider{Provider: NewStaticProvider(m)}
}

// Assign values to a map element based on value type.
Expand Down Expand Up @@ -101,10 +102,6 @@ func traversePath(m map[string]interface{}, f *flag.Flag) (prev map[string]inter
return prev, path[len(path)-1]
}

func (c *commandLineProvider) Name() string {
func (commandLineProvider) Name() string {
return "cmd"
}

func (c *commandLineProvider) Get(key string) Value {
return c.p.Get(key)
}

0 comments on commit 65793b2

Please sign in to comment.