Early return
This commit is contained in:
parent
6b468a429a
commit
dada32c78b
15
restore.go
15
restore.go
|
@ -39,14 +39,15 @@ func RestoreAsset(dir, name string) error {
|
||||||
// RestoreAssets restores an asset under the given directory recursively
|
// RestoreAssets restores an asset under the given directory recursively
|
||||||
func RestoreAssets(dir, name string) error {
|
func RestoreAssets(dir, name string) error {
|
||||||
children, err := AssetDir(name)
|
children, err := AssetDir(name)
|
||||||
if err != nil { // File
|
// File
|
||||||
|
if err != nil {
|
||||||
return RestoreAsset(dir, name)
|
return RestoreAsset(dir, name)
|
||||||
} else { // Dir
|
}
|
||||||
for _, child := range children {
|
// Dir
|
||||||
err = RestoreAssets(dir, path.Join(name, child))
|
for _, child := range children {
|
||||||
if err != nil {
|
err = RestoreAssets(dir, path.Join(name, child))
|
||||||
return err
|
if err != nil {
|
||||||
}
|
return err
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
|
|
15
testdata/out/compress-memcopy.go
vendored
15
testdata/out/compress-memcopy.go
vendored
|
@ -288,14 +288,15 @@ func RestoreAsset(dir, name string) error {
|
||||||
// RestoreAssets restores an asset under the given directory recursively
|
// RestoreAssets restores an asset under the given directory recursively
|
||||||
func RestoreAssets(dir, name string) error {
|
func RestoreAssets(dir, name string) error {
|
||||||
children, err := AssetDir(name)
|
children, err := AssetDir(name)
|
||||||
if err != nil { // File
|
// File
|
||||||
|
if err != nil {
|
||||||
return RestoreAsset(dir, name)
|
return RestoreAsset(dir, name)
|
||||||
} else { // Dir
|
}
|
||||||
for _, child := range children {
|
// Dir
|
||||||
err = RestoreAssets(dir, path.Join(name, child))
|
for _, child := range children {
|
||||||
if err != nil {
|
err = RestoreAssets(dir, path.Join(name, child))
|
||||||
return err
|
if err != nil {
|
||||||
}
|
return err
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
|
|
15
testdata/out/compress-nomemcopy.go
vendored
15
testdata/out/compress-nomemcopy.go
vendored
|
@ -298,14 +298,15 @@ func RestoreAsset(dir, name string) error {
|
||||||
// RestoreAssets restores an asset under the given directory recursively
|
// RestoreAssets restores an asset under the given directory recursively
|
||||||
func RestoreAssets(dir, name string) error {
|
func RestoreAssets(dir, name string) error {
|
||||||
children, err := AssetDir(name)
|
children, err := AssetDir(name)
|
||||||
if err != nil { // File
|
// File
|
||||||
|
if err != nil {
|
||||||
return RestoreAsset(dir, name)
|
return RestoreAsset(dir, name)
|
||||||
} else { // Dir
|
}
|
||||||
for _, child := range children {
|
// Dir
|
||||||
err = RestoreAssets(dir, path.Join(name, child))
|
for _, child := range children {
|
||||||
if err != nil {
|
err = RestoreAssets(dir, path.Join(name, child))
|
||||||
return err
|
if err != nil {
|
||||||
}
|
return err
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
|
|
15
testdata/out/debug.go
vendored
15
testdata/out/debug.go
vendored
|
@ -239,14 +239,15 @@ func RestoreAsset(dir, name string) error {
|
||||||
// RestoreAssets restores an asset under the given directory recursively
|
// RestoreAssets restores an asset under the given directory recursively
|
||||||
func RestoreAssets(dir, name string) error {
|
func RestoreAssets(dir, name string) error {
|
||||||
children, err := AssetDir(name)
|
children, err := AssetDir(name)
|
||||||
if err != nil { // File
|
// File
|
||||||
|
if err != nil {
|
||||||
return RestoreAsset(dir, name)
|
return RestoreAsset(dir, name)
|
||||||
} else { // Dir
|
}
|
||||||
for _, child := range children {
|
// Dir
|
||||||
err = RestoreAssets(dir, path.Join(name, child))
|
for _, child := range children {
|
||||||
if err != nil {
|
err = RestoreAssets(dir, path.Join(name, child))
|
||||||
return err
|
if err != nil {
|
||||||
}
|
return err
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
|
|
15
testdata/out/nocompress-memcopy.go
vendored
15
testdata/out/nocompress-memcopy.go
vendored
|
@ -256,14 +256,15 @@ func RestoreAsset(dir, name string) error {
|
||||||
// RestoreAssets restores an asset under the given directory recursively
|
// RestoreAssets restores an asset under the given directory recursively
|
||||||
func RestoreAssets(dir, name string) error {
|
func RestoreAssets(dir, name string) error {
|
||||||
children, err := AssetDir(name)
|
children, err := AssetDir(name)
|
||||||
if err != nil { // File
|
// File
|
||||||
|
if err != nil {
|
||||||
return RestoreAsset(dir, name)
|
return RestoreAsset(dir, name)
|
||||||
} else { // Dir
|
}
|
||||||
for _, child := range children {
|
// Dir
|
||||||
err = RestoreAssets(dir, path.Join(name, child))
|
for _, child := range children {
|
||||||
if err != nil {
|
err = RestoreAssets(dir, path.Join(name, child))
|
||||||
return err
|
if err != nil {
|
||||||
}
|
return err
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
|
|
15
testdata/out/nocompress-nomemcopy.go
vendored
15
testdata/out/nocompress-nomemcopy.go
vendored
|
@ -278,14 +278,15 @@ func RestoreAsset(dir, name string) error {
|
||||||
// RestoreAssets restores an asset under the given directory recursively
|
// RestoreAssets restores an asset under the given directory recursively
|
||||||
func RestoreAssets(dir, name string) error {
|
func RestoreAssets(dir, name string) error {
|
||||||
children, err := AssetDir(name)
|
children, err := AssetDir(name)
|
||||||
if err != nil { // File
|
// File
|
||||||
|
if err != nil {
|
||||||
return RestoreAsset(dir, name)
|
return RestoreAsset(dir, name)
|
||||||
} else { // Dir
|
}
|
||||||
for _, child := range children {
|
// Dir
|
||||||
err = RestoreAssets(dir, path.Join(name, child))
|
for _, child := range children {
|
||||||
if err != nil {
|
err = RestoreAssets(dir, path.Join(name, child))
|
||||||
return err
|
if err != nil {
|
||||||
}
|
return err
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
|
|
Loading…
Reference in New Issue
Block a user