Early return
This commit is contained in:
parent
6b468a429a
commit
dada32c78b
|
@ -39,16 +39,17 @@ 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
|
}
|
||||||
|
// Dir
|
||||||
for _, child := range children {
|
for _, child := range children {
|
||||||
err = RestoreAssets(dir, path.Join(name, child))
|
err = RestoreAssets(dir, path.Join(name, child))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
7
testdata/out/compress-memcopy.go
vendored
7
testdata/out/compress-memcopy.go
vendored
|
@ -288,16 +288,17 @@ 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
|
}
|
||||||
|
// Dir
|
||||||
for _, child := range children {
|
for _, child := range children {
|
||||||
err = RestoreAssets(dir, path.Join(name, child))
|
err = RestoreAssets(dir, path.Join(name, child))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
7
testdata/out/compress-nomemcopy.go
vendored
7
testdata/out/compress-nomemcopy.go
vendored
|
@ -298,16 +298,17 @@ 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
|
}
|
||||||
|
// Dir
|
||||||
for _, child := range children {
|
for _, child := range children {
|
||||||
err = RestoreAssets(dir, path.Join(name, child))
|
err = RestoreAssets(dir, path.Join(name, child))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
7
testdata/out/debug.go
vendored
7
testdata/out/debug.go
vendored
|
@ -239,16 +239,17 @@ 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
|
}
|
||||||
|
// Dir
|
||||||
for _, child := range children {
|
for _, child := range children {
|
||||||
err = RestoreAssets(dir, path.Join(name, child))
|
err = RestoreAssets(dir, path.Join(name, child))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
7
testdata/out/nocompress-memcopy.go
vendored
7
testdata/out/nocompress-memcopy.go
vendored
|
@ -256,16 +256,17 @@ 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
|
}
|
||||||
|
// Dir
|
||||||
for _, child := range children {
|
for _, child := range children {
|
||||||
err = RestoreAssets(dir, path.Join(name, child))
|
err = RestoreAssets(dir, path.Join(name, child))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
7
testdata/out/nocompress-nomemcopy.go
vendored
7
testdata/out/nocompress-nomemcopy.go
vendored
|
@ -278,16 +278,17 @@ 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
|
}
|
||||||
|
// Dir
|
||||||
for _, child := range children {
|
for _, child := range children {
|
||||||
err = RestoreAssets(dir, path.Join(name, child))
|
err = RestoreAssets(dir, path.Join(name, child))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user