diff options
author | Sebastiaan van Stijn <github@gone.nl> | 2018-12-22 02:23:17 +0100 |
---|---|---|
committer | Sebastiaan van Stijn <github@gone.nl> | 2018-12-22 16:04:45 +0100 |
commit | 342f7a357ad00164c5f8130127ab54a1d823b1de (patch) | |
tree | 915ce20ced20c0f6b86b7e2fcdf7a0b0c26a49ea /volume | |
parent | d5b271c155926057d33c2128ff57e49274455813 (diff) | |
download | docker-342f7a357ad00164c5f8130127ab54a1d823b1de.tar.gz |
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>
Diffstat (limited to 'volume')
-rw-r--r-- | volume/local/local.go | 2 | ||||
-rw-r--r-- | volume/local/local_unix.go | 8 | ||||
-rw-r--r-- | volume/local/local_windows.go | 2 |
3 files changed, 6 insertions, 6 deletions
diff --git a/volume/local/local.go b/volume/local/local.go index 1c844cf0e3..6bf2aa9015 100644 --- a/volume/local/local.go +++ b/volume/local/local.go @@ -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)) } } diff --git a/volume/local/local_unix.go b/volume/local/local_unix.go index 1d25c330da..e8f12c9030 100644 --- a/volume/local/local_unix.go +++ b/volume/local/local_unix.go @@ -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": {}, diff --git a/volume/local/local_windows.go b/volume/local/local_windows.go index 5748681bb0..eb19e79747 100644 --- a/volume/local/local_windows.go +++ b/volume/local/local_windows.go @@ -15,7 +15,7 @@ import ( type optsConfig struct{} var ( - validOpts map[string]bool + validOpts map[string]struct{} mandatoryOpts map[string]struct{} ) |