Browse Source

pkg/containerfs: rename output variable to prevent shadowing (govet)

```
pkg/containerfs/archiver.go:121:6: shadow: declaration of "err" shadows declaration at line 92 (govet)
	if err := dstDriver.MkdirAll(dstDriver.Dir(dst), 0700); err != nil {
```

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
Sebastiaan van Stijn 6 years ago
parent
commit
323ac07901
1 changed files with 10 additions and 10 deletions
  1. 10 10
      pkg/containerfs/archiver.go

+ 10 - 10
pkg/containerfs/archiver.go

@@ -89,14 +89,14 @@ func (archiver *Archiver) CopyWithTar(src, dst string) error {
 // CopyFileWithTar emulates the behavior of the 'cp' command-line
 // CopyFileWithTar emulates the behavior of the 'cp' command-line
 // for a single file. It copies a regular file from path `src` to
 // for a single file. It copies a regular file from path `src` to
 // path `dst`, and preserves all its metadata.
 // path `dst`, and preserves all its metadata.
-func (archiver *Archiver) CopyFileWithTar(src, dst string) (err error) {
+func (archiver *Archiver) CopyFileWithTar(src, dst string) (retErr error) {
 	logrus.Debugf("CopyFileWithTar(%s, %s)", src, dst)
 	logrus.Debugf("CopyFileWithTar(%s, %s)", src, dst)
 	srcDriver := archiver.SrcDriver
 	srcDriver := archiver.SrcDriver
 	dstDriver := archiver.DstDriver
 	dstDriver := archiver.DstDriver
 
 
-	srcSt, err := srcDriver.Stat(src)
-	if err != nil {
-		return err
+	srcSt, retErr := srcDriver.Stat(src)
+	if retErr != nil {
+		return retErr
 	}
 	}
 
 
 	if srcSt.IsDir() {
 	if srcSt.IsDir() {
@@ -168,16 +168,16 @@ func (archiver *Archiver) CopyFileWithTar(src, dst string) (err error) {
 		}()
 		}()
 	}()
 	}()
 	defer func() {
 	defer func() {
-		if er := <-errC; err == nil && er != nil {
-			err = er
+		if err := <-errC; retErr == nil && err != nil {
+			retErr = err
 		}
 		}
 	}()
 	}()
 
 
-	err = archiver.Untar(r, dstDriver.Dir(dst), nil)
-	if err != nil {
-		r.CloseWithError(err)
+	retErr = archiver.Untar(r, dstDriver.Dir(dst), nil)
+	if retErr != nil {
+		r.CloseWithError(retErr)
 	}
 	}
-	return err
+	return retErr
 }
 }
 
 
 // IdentityMapping returns the IdentityMapping of the archiver.
 // IdentityMapping returns the IdentityMapping of the archiver.