Files
moby/daemon/graphdriver/utils.go
Sebastiaan van Stijn 5b18a7914c deprecate pkg/parsers.ParseKeyValueOpt and move internal
Move the utility to where it's used, and deprecate the implementation
in pkg/parsers.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-01-09 13:14:09 +01:00

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
}