Skip to content

Commit

Permalink
Early return
Browse files Browse the repository at this point in the history
  • Loading branch information
tamird committed May 11, 2015
1 parent 6b468a4 commit dada32c
Show file tree
Hide file tree
Showing 6 changed files with 48 additions and 42 deletions.
15 changes: 8 additions & 7 deletions restore.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,14 +39,15 @@ 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
for _, child := range children {
err = RestoreAssets(dir, path.Join(name, child))
if err != nil {
return err
}
}
// Dir
for _, child := range children {
err = RestoreAssets(dir, path.Join(name, child))
if err != nil {
return err
}
}
return nil
Expand Down
15 changes: 8 additions & 7 deletions testdata/out/compress-memcopy.go
Original file line number Diff line number Diff line change
Expand Up @@ -288,14 +288,15 @@ 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
for _, child := range children {
err = RestoreAssets(dir, path.Join(name, child))
if err != nil {
return err
}
}
// Dir
for _, child := range children {
err = RestoreAssets(dir, path.Join(name, child))
if err != nil {
return err
}
}
return nil
Expand Down
15 changes: 8 additions & 7 deletions testdata/out/compress-nomemcopy.go
Original file line number Diff line number Diff line change
Expand Up @@ -298,14 +298,15 @@ 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
for _, child := range children {
err = RestoreAssets(dir, path.Join(name, child))
if err != nil {
return err
}
}
// Dir
for _, child := range children {
err = RestoreAssets(dir, path.Join(name, child))
if err != nil {
return err
}
}
return nil
Expand Down
15 changes: 8 additions & 7 deletions testdata/out/debug.go
Original file line number Diff line number Diff line change
Expand Up @@ -239,14 +239,15 @@ 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
for _, child := range children {
err = RestoreAssets(dir, path.Join(name, child))
if err != nil {
return err
}
}
// Dir
for _, child := range children {
err = RestoreAssets(dir, path.Join(name, child))
if err != nil {
return err
}
}
return nil
Expand Down
15 changes: 8 additions & 7 deletions testdata/out/nocompress-memcopy.go
Original file line number Diff line number Diff line change
Expand Up @@ -256,14 +256,15 @@ 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
for _, child := range children {
err = RestoreAssets(dir, path.Join(name, child))
if err != nil {
return err
}
}
// Dir
for _, child := range children {
err = RestoreAssets(dir, path.Join(name, child))
if err != nil {
return err
}
}
return nil
Expand Down
15 changes: 8 additions & 7 deletions testdata/out/nocompress-nomemcopy.go
Original file line number Diff line number Diff line change
Expand Up @@ -278,14 +278,15 @@ 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
for _, child := range children {
err = RestoreAssets(dir, path.Join(name, child))
if err != nil {
return err
}
}
// Dir
for _, child := range children {
err = RestoreAssets(dir, path.Join(name, child))
if err != nil {
return err
}
}
return nil
Expand Down

0 comments on commit dada32c

Please sign in to comment.