Browse code

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 authored on 2019/08/28 02:18:39
Showing 1 changed files
... ...
@@ -89,14 +89,14 @@ func (archiver *Archiver) CopyWithTar(src, dst string) error {
89 89
 // CopyFileWithTar emulates the behavior of the 'cp' command-line
90 90
 // for a single file. It copies a regular file from path `src` to
91 91
 // path `dst`, and preserves all its metadata.
92
-func (archiver *Archiver) CopyFileWithTar(src, dst string) (err error) {
92
+func (archiver *Archiver) CopyFileWithTar(src, dst string) (retErr error) {
93 93
 	logrus.Debugf("CopyFileWithTar(%s, %s)", src, dst)
94 94
 	srcDriver := archiver.SrcDriver
95 95
 	dstDriver := archiver.DstDriver
96 96
 
97
-	srcSt, err := srcDriver.Stat(src)
98
-	if err != nil {
99
-		return err
97
+	srcSt, retErr := srcDriver.Stat(src)
98
+	if retErr != nil {
99
+		return retErr
100 100
 	}
101 101
 
102 102
 	if srcSt.IsDir() {
... ...
@@ -168,16 +168,16 @@ func (archiver *Archiver) CopyFileWithTar(src, dst string) (err error) {
168 168
 		}()
169 169
 	}()
170 170
 	defer func() {
171
-		if er := <-errC; err == nil && er != nil {
172
-			err = er
171
+		if err := <-errC; retErr == nil && err != nil {
172
+			retErr = err
173 173
 		}
174 174
 	}()
175 175
 
176
-	err = archiver.Untar(r, dstDriver.Dir(dst), nil)
177
-	if err != nil {
178
-		r.CloseWithError(err)
176
+	retErr = archiver.Untar(r, dstDriver.Dir(dst), nil)
177
+	if retErr != nil {
178
+		r.CloseWithError(retErr)
179 179
 	}
180
-	return err
180
+	return retErr
181 181
 }
182 182
 
183 183
 // IdentityMapping returns the IdentityMapping of the archiver.