github.com/Prakhar-Agarwal-byte/moby@v0.0.0-20231027092010-a14e3e8ab87e/runconfig/opts/parse.go (about)

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