Early return

This commit is contained in:
Tamir Duberstein 2015-05-11 15:47:48 -04:00
parent 6b468a429a
commit dada32c78b
6 changed files with 48 additions and 42 deletions

View File

@ -39,16 +39,17 @@ func RestoreAsset(dir, name string) error {
// RestoreAssets restores an asset under the given directory recursively
func RestoreAssets(dir, name string) error {
children, err := AssetDir(name)
if err != nil { // File
// File
if err != nil {
return RestoreAsset(dir, name)
} else { // Dir
}
// Dir
for _, child := range children {
err = RestoreAssets(dir, path.Join(name, child))
if err != nil {
return err
}
}
}
return nil
}

View File

@ -288,16 +288,17 @@ func RestoreAsset(dir, name string) error {
// RestoreAssets restores an asset under the given directory recursively
func RestoreAssets(dir, name string) error {
children, err := AssetDir(name)
if err != nil { // File
// File
if err != nil {
return RestoreAsset(dir, name)
} else { // Dir
}
// Dir
for _, child := range children {
err = RestoreAssets(dir, path.Join(name, child))
if err != nil {
return err
}
}
}
return nil
}

View File

@ -298,16 +298,17 @@ func RestoreAsset(dir, name string) error {
// RestoreAssets restores an asset under the given directory recursively
func RestoreAssets(dir, name string) error {
children, err := AssetDir(name)
if err != nil { // File
// File
if err != nil {
return RestoreAsset(dir, name)
} else { // Dir
}
// Dir
for _, child := range children {
err = RestoreAssets(dir, path.Join(name, child))
if err != nil {
return err
}
}
}
return nil
}

View File

@ -239,16 +239,17 @@ func RestoreAsset(dir, name string) error {
// RestoreAssets restores an asset under the given directory recursively
func RestoreAssets(dir, name string) error {
children, err := AssetDir(name)
if err != nil { // File
// File
if err != nil {
return RestoreAsset(dir, name)
} else { // Dir
}
// Dir
for _, child := range children {
err = RestoreAssets(dir, path.Join(name, child))
if err != nil {
return err
}
}
}
return nil
}

View File

@ -256,16 +256,17 @@ func RestoreAsset(dir, name string) error {
// RestoreAssets restores an asset under the given directory recursively
func RestoreAssets(dir, name string) error {
children, err := AssetDir(name)
if err != nil { // File
// File
if err != nil {
return RestoreAsset(dir, name)
} else { // Dir
}
// Dir
for _, child := range children {
err = RestoreAssets(dir, path.Join(name, child))
if err != nil {
return err
}
}
}
return nil
}

View File

@ -278,16 +278,17 @@ func RestoreAsset(dir, name string) error {
// RestoreAssets restores an asset under the given directory recursively
func RestoreAssets(dir, name string) error {
children, err := AssetDir(name)
if err != nil { // File
// File
if err != nil {
return RestoreAsset(dir, name)
} else { // Dir
}
// Dir
for _, child := range children {
err = RestoreAssets(dir, path.Join(name, child))
if err != nil {
return err
}
}
}
return nil
}