Prechádzať zdrojové kódy

Merge pull request #16804 from Microsoft/jjh/fixpullimageifnotexist

No err shadowing on pullImageIfNotExist
Vincent Demeester 9 rokov pred
rodič
commit
aee0fcf413
1 zmenil súbory, kde vykonal 3 pridanie a 3 odobranie
  1. 3 3
      integration-cli/docker_utils.go

+ 3 - 3
integration-cli/docker_utils.go

@@ -609,16 +609,16 @@ func imageExists(image string) error {
 	return err
 	return err
 }
 }
 
 
-func pullImageIfNotExist(image string) (err error) {
+func pullImageIfNotExist(image string) error {
 	if err := imageExists(image); err != nil {
 	if err := imageExists(image); err != nil {
 		pullCmd := exec.Command(dockerBinary, "pull", image)
 		pullCmd := exec.Command(dockerBinary, "pull", image)
 		_, exitCode, err := runCommandWithOutput(pullCmd)
 		_, exitCode, err := runCommandWithOutput(pullCmd)
 
 
 		if err != nil || exitCode != 0 {
 		if err != nil || exitCode != 0 {
-			err = fmt.Errorf("image %q wasn't found locally and it couldn't be pulled: %s", image, err)
+			return fmt.Errorf("image %q wasn't found locally and it couldn't be pulled: %s", image, err)
 		}
 		}
 	}
 	}
-	return
+	return nil
 }
 }
 
 
 func dockerCmdWithError(args ...string) (string, int, error) {
 func dockerCmdWithError(args ...string) (string, int, error) {