pkg/flags: fix "Set"

Signed-off-by: Gyuho Lee <gyuhox@gmail.com>
This commit is contained in:
Gyuho Lee 2018-03-26 18:16:41 -07:00
parent 3b1eaaee6e
commit 089e8ffecb
2 changed files with 3 additions and 0 deletions

View File

@ -30,6 +30,7 @@ type UniqueStringsValue struct {
// Implements "flag.Value" interface.
// The values are set in order.
func (us *UniqueStringsValue) Set(s string) error {
us.Values = make(map[string]struct{})
for _, v := range strings.Split(s, ",") {
us.Values[v] = struct{}{}
}

View File

@ -46,6 +46,8 @@ func (us *UniqueURLs) Set(s string) error {
if err != nil {
return err
}
us.Values = make(map[string]struct{})
us.uss = make([]url.URL, 0)
for _, v := range ss {
us.Values[v.String()] = struct{}{}
us.uss = append(us.uss, v)