Skip to content

Commit

Permalink
Nitpick plugin/manager.go: use loop to create directories
Browse files Browse the repository at this point in the history
Instead of duplicating the same if condition per plugin manager directory,
use one if condition and a for-loop.

Signed-off-by: Boaz Shuster <[email protected]>
  • Loading branch information
boaz0 committed Nov 1, 2017
1 parent ba99c19 commit d75f1d8
Showing 1 changed file with 4 additions and 8 deletions.
12 changes: 4 additions & 8 deletions plugin/manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
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())
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 := setupRoot(manager.config.Root); err != nil {
Expand Down

0 comments on commit d75f1d8

Please sign in to comment.