parse.go 374 B

12345678910111213141516
  1. package opts // import "github.com/docker/docker/runconfig/opts"
  2. import (
  3. "strings"
  4. )
  5. // ConvertKVStringsToMap converts ["key=value"] to {"key":"value"}
  6. func ConvertKVStringsToMap(values []string) map[string]string {
  7. result := make(map[string]string, len(values))
  8. for _, value := range values {
  9. k, v, _ := strings.Cut(value, "=")
  10. result[k] = v
  11. }
  12. return result
  13. }