1
0
Fork 0
mirror of https://github.com/moby/moby.git synced 2022-11-09 12:21:53 -05:00

Switch back config to map[string]struct{}

This commit is contained in:
Guillaume J. Charmes 2013-04-10 16:09:34 -07:00
parent 8d9aaee60b
commit faf8daa7c6
2 changed files with 4 additions and 4 deletions

View file

@ -915,21 +915,21 @@ func (opts AttachOpts) Get(val string) bool {
} }
// PathOpts stores a unique set of absolute paths // PathOpts stores a unique set of absolute paths
type PathOpts map[string]string type PathOpts map[string]struct{}
func NewPathOpts() PathOpts { func NewPathOpts() PathOpts {
return make(PathOpts) return make(PathOpts)
} }
func (opts PathOpts) String() string { func (opts PathOpts) String() string {
return fmt.Sprintf("%v", map[string]string(opts)) return fmt.Sprintf("%v", map[string]struct{}(opts))
} }
func (opts PathOpts) Set(val string) error { func (opts PathOpts) Set(val string) error {
if !filepath.IsAbs(val) { if !filepath.IsAbs(val) {
return fmt.Errorf("%s is not an absolute path", val) return fmt.Errorf("%s is not an absolute path", val)
} }
opts[filepath.Clean(val)] = "" opts[filepath.Clean(val)] = struct{}{}
return nil return nil
} }

View file

@ -66,7 +66,7 @@ type Config struct {
Cmd []string Cmd []string
Dns []string Dns []string
Image string // Name of the image as it was passed by the operator (eg. could be symbolic) Image string // Name of the image as it was passed by the operator (eg. could be symbolic)
Volumes map[string]string Volumes map[string]struct{}
} }
func ParseRun(args []string, stdout io.Writer, capabilities *Capabilities) (*Config, error) { func ParseRun(args []string, stdout io.Writer, capabilities *Capabilities) (*Config, error) {