MCPcopy
hub / github.com/etcd-io/etcd / NewUniqueStringsValue

Function NewUniqueStringsValue

pkg/flags/unique_strings.go:59–68  ·  view source on GitHub ↗

NewUniqueStringsValue implements string slice as "flag.Value" interface. Given value is to be separated by comma. The values are set in order.

(s string)

Source from the content-addressed store, hash-verified

57// Given value is to be separated by comma.
58// The values are set in order.
59func NewUniqueStringsValue(s string) (us *UniqueStringsValue) {
60 us = &UniqueStringsValue{Values: make(map[string]struct{})}
61 if s == "" {
62 return us
63 }
64 if err := us.Set(s); err != nil {
65 panic(fmt.Sprintf("new UniqueStringsValue should never fail: %v", err))
66 }
67 return us
68}
69
70// UniqueStringsFromFlag returns a string slice from the flag.
71func UniqueStringsFromFlag(fs *flag.FlagSet, flagName string) []string {

Callers 1

TestNewUniqueStringsFunction · 0.85

Calls 1

SetMethod · 0.65

Tested by 1

TestNewUniqueStringsFunction · 0.68

Used in the wild real call sites across dependent graphs

searching dependent graphs…