forked from toolshed/abra
chore: bump deps
This commit is contained in:
13
vendor/github.com/docker/cli/opts/gpus.go
generated
vendored
13
vendor/github.com/docker/cli/opts/gpus.go
generated
vendored
@ -2,12 +2,12 @@ package opts
|
||||
|
||||
import (
|
||||
"encoding/csv"
|
||||
"errors"
|
||||
"fmt"
|
||||
"strconv"
|
||||
"strings"
|
||||
|
||||
"github.com/docker/docker/api/types/container"
|
||||
"github.com/pkg/errors"
|
||||
)
|
||||
|
||||
// GpuOpts is a Value type for parsing mounts
|
||||
@ -20,7 +20,14 @@ func parseCount(s string) (int, error) {
|
||||
return -1, nil
|
||||
}
|
||||
i, err := strconv.Atoi(s)
|
||||
return i, errors.Wrap(err, "count must be an integer")
|
||||
if err != nil {
|
||||
var numErr *strconv.NumError
|
||||
if errors.As(err, &numErr) {
|
||||
err = numErr.Err
|
||||
}
|
||||
return 0, fmt.Errorf(`invalid count (%s): value must be either "all" or an integer: %w`, s, err)
|
||||
}
|
||||
return i, nil
|
||||
}
|
||||
|
||||
// Set a new mount value
|
||||
@ -69,7 +76,7 @@ func (o *GpuOpts) Set(value string) error {
|
||||
r := csv.NewReader(strings.NewReader(val))
|
||||
optFields, err := r.Read()
|
||||
if err != nil {
|
||||
return errors.Wrap(err, "failed to read gpu options")
|
||||
return fmt.Errorf("failed to read gpu options: %w", err)
|
||||
}
|
||||
req.Options = ConvertKVStringsToMap(optFields)
|
||||
default:
|
||||
|
Reference in New Issue
Block a user