mirror of
https://github.com/moby/moby.git
synced 2026-01-11 18:51:37 +00:00
Move the utility to where it's used, and deprecate the implementation in pkg/parsers. Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
17 lines
421 B
Go
17 lines
421 B
Go
package graphdriver
|
|
|
|
import (
|
|
"fmt"
|
|
"strings"
|
|
)
|
|
|
|
// ParseStorageOptKeyValue parses and validates the specified string as a key/value
|
|
// pair (key=value).
|
|
func ParseStorageOptKeyValue(opt string) (key string, value string, err error) {
|
|
k, v, ok := strings.Cut(opt, "=")
|
|
if !ok {
|
|
return "", "", fmt.Errorf("unable to parse storage-opt key/value: %s", opt)
|
|
}
|
|
return strings.TrimSpace(k), strings.TrimSpace(v), nil
|
|
}
|