mirror of
https://github.com/moby/moby.git
synced 2022-11-09 12:21:53 -05:00
Use a map[string]struct{} for validOpts
For consistency with `mandatoryOpts`, and because it is a tiny-tiny bit more efficient. Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
This commit is contained in:
parent
d5b271c155
commit
342f7a357a
3 changed files with 6 additions and 6 deletions
|
@ -357,7 +357,7 @@ func validateOpts(opts map[string]string) error {
|
|||
return nil
|
||||
}
|
||||
for opt := range opts {
|
||||
if !validOpts[opt] {
|
||||
if _, ok := validOpts[opt]; !ok {
|
||||
return validationError(fmt.Sprintf("invalid option key: %q", opt))
|
||||
}
|
||||
}
|
||||
|
|
|
@ -22,10 +22,10 @@ import (
|
|||
var (
|
||||
oldVfsDir = filepath.Join("vfs", "dir")
|
||||
|
||||
validOpts = map[string]bool{
|
||||
"type": true, // specify the filesystem type for mount, e.g. nfs
|
||||
"o": true, // generic mount options
|
||||
"device": true, // device to mount from
|
||||
validOpts = map[string]struct{}{
|
||||
"type": {}, // specify the filesystem type for mount, e.g. nfs
|
||||
"o": {}, // generic mount options
|
||||
"device": {}, // device to mount from
|
||||
}
|
||||
mandatoryOpts = map[string]struct{}{
|
||||
"device": {},
|
||||
|
|
|
@ -15,7 +15,7 @@ import (
|
|||
type optsConfig struct{}
|
||||
|
||||
var (
|
||||
validOpts map[string]bool
|
||||
validOpts map[string]struct{}
|
||||
mandatoryOpts map[string]struct{}
|
||||
)
|
||||
|
||||
|
|
Loading…
Reference in a new issue