Explorar el Código

integration-cli: TestBuildAddBadLinks, TestBuildAddBadLinksVolume: simplify check

This fixes the following lint warning:

> integration-cli/docker_cli_build_test.go:1001:59: nilness: tautological condition: non-nil != nil (govet)
>	if _, err := os.Stat(nonExistingFile); err == nil || err != nil && !os.IsNotExist(err) {
>	                                                         ^

Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
Kir Kolyshkin hace 5 años
padre
commit
6aadd436a9
Se han modificado 1 ficheros con 2 adiciones y 2 borrados
  1. 2 2
      integration-cli/docker_cli_build_test.go

+ 2 - 2
integration-cli/docker_cli_build_test.go

@@ -998,7 +998,7 @@ func (s *DockerSuite) TestBuildAddBadLinks(c *testing.T) {
 	}
 	}
 
 
 	buildImageSuccessfully(c, name, build.WithExternalBuildContext(ctx))
 	buildImageSuccessfully(c, name, build.WithExternalBuildContext(ctx))
-	if _, err := os.Stat(nonExistingFile); err == nil || err != nil && !os.IsNotExist(err) {
+	if _, err := os.Stat(nonExistingFile); err == nil || !os.IsNotExist(err) {
 		c.Fatalf("%s shouldn't have been written and it shouldn't exist", nonExistingFile)
 		c.Fatalf("%s shouldn't have been written and it shouldn't exist", nonExistingFile)
 	}
 	}
 
 
@@ -1039,7 +1039,7 @@ func (s *DockerSuite) TestBuildAddBadLinksVolume(c *testing.T) {
 	}
 	}
 
 
 	buildImageSuccessfully(c, "test-link-absolute-volume", build.WithExternalBuildContext(ctx))
 	buildImageSuccessfully(c, "test-link-absolute-volume", build.WithExternalBuildContext(ctx))
-	if _, err := os.Stat(nonExistingFile); err == nil || err != nil && !os.IsNotExist(err) {
+	if _, err := os.Stat(nonExistingFile); err == nil || !os.IsNotExist(err) {
 		c.Fatalf("%s shouldn't have been written and it shouldn't exist", nonExistingFile)
 		c.Fatalf("%s shouldn't have been written and it shouldn't exist", nonExistingFile)
 	}
 	}