mirror of
https://github.com/moby/moby.git
synced 2022-11-09 12:21:53 -05:00
Nitpick plugin/manager.go: use loop to create directories
Instead of duplicating the same if condition per plugin manager directory, use one if condition and a for-loop. Signed-off-by: Boaz Shuster <ripcurld.github@gmail.com>
This commit is contained in:
parent
ba99c19b59
commit
d75f1d8487
1 changed files with 4 additions and 8 deletions
|
@ -107,14 +107,10 @@ func NewManager(config ManagerConfig) (*Manager, error) {
|
|||
manager := &Manager{
|
||||
config: config,
|
||||
}
|
||||
if err := os.MkdirAll(manager.config.Root, 0700); err != nil {
|
||||
return nil, errors.Wrapf(err, "failed to mkdir %v", manager.config.Root)
|
||||
for _, dirName := range []string{manager.config.Root, manager.config.ExecRoot, manager.tmpDir()} {
|
||||
if err := os.MkdirAll(dirName, 0700); err != nil {
|
||||
return nil, errors.Wrapf(err, "failed to mkdir %v", dirName)
|
||||
}
|
||||
if err := os.MkdirAll(manager.config.ExecRoot, 0700); err != nil {
|
||||
return nil, errors.Wrapf(err, "failed to mkdir %v", manager.config.ExecRoot)
|
||||
}
|
||||
if err := os.MkdirAll(manager.tmpDir(), 0700); err != nil {
|
||||
return nil, errors.Wrapf(err, "failed to mkdir %v", manager.tmpDir())
|
||||
}
|
||||
|
||||
if err := setupRoot(manager.config.Root); err != nil {
|
||||
|
|
Loading…
Reference in a new issue