ConvertToMap takes a slice of strings in the format "key=value" and converts it into a Data map. Each string in the slice is split into a key and value pair using the first occurrence of the "=" character. If a string does not contain the "=" character, it is ignored. The resulting map contains the
(args []string)
| 26 | // |
| 27 | // Data: A map where the keys and values are derived from the input slice. |
| 28 | func ConvertToMap(args []string) Data { |
| 29 | m := make(Data) |
| 30 | for _, arg := range args { |
| 31 | kv := strings.SplitN(arg, "=", 2) |
| 32 | if len(kv) == 2 { |
| 33 | m[kv[0]] = kv[1] |
| 34 | } |
| 35 | } |
| 36 | return m |
| 37 | } |
no outgoing calls