mirror of
https://github.com/docker/cli.git
synced 2026-09-28 02:06:53 -04:00
opts: MountOpt: improve error for empty value
Before this patch:
docker run --rm --mount "" busybox
invalid argument "" for "--mount" flag: EOF
With this patch:
docker run --rm --mount "" busybox
invalid argument "" for "--mount" flag: value is empty
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
This commit is contained in:
@@ -22,6 +22,11 @@ type MountOpt struct {
|
||||
//
|
||||
//nolint:gocyclo
|
||||
func (m *MountOpt) Set(value string) error {
|
||||
value = strings.TrimSpace(value)
|
||||
if value == "" {
|
||||
return errors.New("value is empty")
|
||||
}
|
||||
|
||||
csvReader := csv.NewReader(strings.NewReader(value))
|
||||
fields, err := csvReader.Read()
|
||||
if err != nil {
|
||||
|
||||
Reference in New Issue
Block a user