MCPcopy
hub / github.com/spf13/pflag / String

Method String

string_to_string.go:65–85  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

63}
64
65func (s *stringToStringValue) String() string {
66 keys := make([]string, 0, len(*s.value))
67 for k := range *s.value {
68 keys = append(keys, k)
69 }
70 sort.Strings(keys)
71
72 records := make([]string, 0, len(*s.value)>>1)
73 for _, k := range keys {
74 v := (*s.value)[k]
75 records = append(records, k+"="+v)
76 }
77
78 var buf bytes.Buffer
79 w := csv.NewWriter(&buf)
80 if err := w.Write(records); err != nil {
81 panic(err)
82 }
83 w.Flush()
84 return "[" + strings.TrimSpace(buf.String()) + "]"
85}
86
87func stringToStringConv(val string) (interface{}, error) {
88 val = strings.Trim(val, "[]")

Callers

nothing calls this directly

Calls 1

StringMethod · 0.65

Tested by

no test coverage detected