From 0ce2eae5a29ea982212870545c020e2b69d1f0db Mon Sep 17 00:00:00 2001 From: Silvin Lubecki Date: Tue, 2 Apr 2019 13:08:04 +0200 Subject: [PATCH] cli/command/image/build/context_test.go:252:71: `createTestTempFile` - `perm` always receives `0777` (`511`) (unparam) Signed-off-by: Silvin Lubecki --- cli/command/image/build/context_test.go | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/cli/command/image/build/context_test.go b/cli/command/image/build/context_test.go index 5404f7aa5d..b0e77058fa 100644 --- a/cli/command/image/build/context_test.go +++ b/cli/command/image/build/context_test.go @@ -29,7 +29,7 @@ var prepareNoFiles = func(t *testing.T) (string, func()) { var prepareOneFile = func(t *testing.T) (string, func()) { contextDir, cleanup := createTestTempDir(t, "builder-context-test") - createTestTempFile(t, contextDir, DefaultDockerfileName, dockerfileContents, 0777) + createTestTempFile(t, contextDir, DefaultDockerfileName, dockerfileContents) return contextDir, cleanup } @@ -73,7 +73,7 @@ func TestGetContextFromLocalDirWithNoDirectory(t *testing.T) { contextDir, dirCleanup := createTestTempDir(t, "builder-context-test") defer dirCleanup() - createTestTempFile(t, contextDir, DefaultDockerfileName, dockerfileContents, 0777) + createTestTempFile(t, contextDir, DefaultDockerfileName, dockerfileContents) chdirCleanup := chdir(t, contextDir) defer chdirCleanup() @@ -89,7 +89,7 @@ func TestGetContextFromLocalDirWithDockerfile(t *testing.T) { contextDir, cleanup := createTestTempDir(t, "builder-context-test") defer cleanup() - createTestTempFile(t, contextDir, DefaultDockerfileName, dockerfileContents, 0777) + createTestTempFile(t, contextDir, DefaultDockerfileName, dockerfileContents) absContextDir, relDockerfile, err := GetContextFromLocalDir(contextDir, "") assert.NilError(t, err) @@ -102,8 +102,8 @@ func TestGetContextFromLocalDirLocalFile(t *testing.T) { contextDir, cleanup := createTestTempDir(t, "builder-context-test") defer cleanup() - createTestTempFile(t, contextDir, DefaultDockerfileName, dockerfileContents, 0777) - testFilename := createTestTempFile(t, contextDir, "tmpTest", "test", 0777) + createTestTempFile(t, contextDir, DefaultDockerfileName, dockerfileContents) + testFilename := createTestTempFile(t, contextDir, "tmpTest", "test") absContextDir, relDockerfile, err := GetContextFromLocalDir(testFilename, "") @@ -127,7 +127,7 @@ func TestGetContextFromLocalDirWithCustomDockerfile(t *testing.T) { chdirCleanup := chdir(t, contextDir) defer chdirCleanup() - createTestTempFile(t, contextDir, DefaultDockerfileName, dockerfileContents, 0777) + createTestTempFile(t, contextDir, DefaultDockerfileName, dockerfileContents) absContextDir, relDockerfile, err := GetContextFromLocalDir(contextDir, DefaultDockerfileName) assert.NilError(t, err) @@ -176,7 +176,7 @@ func TestGetContextFromReaderTar(t *testing.T) { contextDir, cleanup := createTestTempDir(t, "builder-context-test") defer cleanup() - createTestTempFile(t, contextDir, DefaultDockerfileName, dockerfileContents, 0777) + createTestTempFile(t, contextDir, DefaultDockerfileName, dockerfileContents) tarStream, err := archive.Tar(contextDir, archive.Uncompressed) assert.NilError(t, err) @@ -249,9 +249,9 @@ func createTestTempDir(t *testing.T, prefix string) (string, func()) { // createTestTempFile creates a temporary file within dir with specific contents and permissions. // When an error occurs, it terminates the test -func createTestTempFile(t *testing.T, dir, filename, contents string, perm os.FileMode) string { +func createTestTempFile(t *testing.T, dir, filename, contents string) string { filePath := filepath.Join(dir, filename) - err := ioutil.WriteFile(filePath, []byte(contents), perm) + err := ioutil.WriteFile(filePath, []byte(contents), 0777) assert.NilError(t, err) return filePath }