diff --git a/integration/integration_test.go b/integration/integration_test.go index 86248ee00..410b9fcdf 100644 --- a/integration/integration_test.go +++ b/integration/integration_test.go @@ -295,7 +295,7 @@ func getBranchCommitAndURL() (branch, commit, url string) { } log.Printf("repo=%q / commit=%q / branch=%q", repo, commit, branch) url = "github.com/" + repo - return + return branch, commit, url } func DockerGitRepo(url string, commit string, branch string) string { diff --git a/pkg/buildcontext/git_test.go b/pkg/buildcontext/git_test.go index 3340b60d5..f2744800c 100644 --- a/pkg/buildcontext/git_test.go +++ b/pkg/buildcontext/git_test.go @@ -34,7 +34,7 @@ func TestGetGitPullMethod(t *testing.T) { testName: "noEnv", setEnv: func() (expectedValue string) { expectedValue = gitPullMethodHTTPS - return + return expectedValue }, }, { @@ -42,7 +42,7 @@ func TestGetGitPullMethod(t *testing.T) { setEnv: func() (expectedValue string) { _ = os.Setenv(gitPullMethodEnvKey, "") expectedValue = gitPullMethodHTTPS - return + return expectedValue }, }, { @@ -54,7 +54,7 @@ func TestGetGitPullMethod(t *testing.T) { } else { expectedValue = gitPullMethodHTTP } - return + return expectedValue }, }, { @@ -62,7 +62,7 @@ func TestGetGitPullMethod(t *testing.T) { setEnv: func() (expectedValue string) { _ = os.Setenv(gitPullMethodEnvKey, gitPullMethodHTTPS) expectedValue = gitPullMethodHTTPS - return + return expectedValue }, }, { @@ -70,7 +70,7 @@ func TestGetGitPullMethod(t *testing.T) { setEnv: func() (expectedValue string) { _ = os.Setenv(gitPullMethodEnvKey, "unknown") expectedValue = gitPullMethodHTTPS - return + return expectedValue }, }, } @@ -92,7 +92,7 @@ func TestGetGitAuth(t *testing.T) { testName: "noEnv", setEnv: func() (expectedValue transport.AuthMethod) { expectedValue = nil - return + return expectedValue }, }, { @@ -100,7 +100,7 @@ func TestGetGitAuth(t *testing.T) { setEnv: func() (expectedValue transport.AuthMethod) { _ = os.Setenv(gitAuthUsernameEnvKey, "") expectedValue = nil - return + return expectedValue }, }, { @@ -108,7 +108,7 @@ func TestGetGitAuth(t *testing.T) { setEnv: func() (expectedValue transport.AuthMethod) { _ = os.Setenv(gitAuthPasswordEnvKey, "") expectedValue = nil - return + return expectedValue }, }, { @@ -117,7 +117,7 @@ func TestGetGitAuth(t *testing.T) { _ = os.Setenv(gitAuthUsernameEnvKey, "") _ = os.Setenv(gitAuthPasswordEnvKey, "") expectedValue = nil - return + return expectedValue }, }, { @@ -126,7 +126,7 @@ func TestGetGitAuth(t *testing.T) { username := "foo" _ = os.Setenv(gitAuthUsernameEnvKey, username) expectedValue = &http.BasicAuth{Username: username} - return + return expectedValue }, }, { @@ -135,7 +135,7 @@ func TestGetGitAuth(t *testing.T) { pass := "super-secret-password-1234" _ = os.Setenv(gitAuthPasswordEnvKey, pass) expectedValue = &http.BasicAuth{Password: pass} - return + return expectedValue }, }, { @@ -146,7 +146,7 @@ func TestGetGitAuth(t *testing.T) { _ = os.Setenv(gitAuthUsernameEnvKey, username) _ = os.Setenv(gitAuthPasswordEnvKey, pass) expectedValue = &http.BasicAuth{Username: username, Password: pass} - return + return expectedValue }, }, { @@ -155,7 +155,7 @@ func TestGetGitAuth(t *testing.T) { token := "some-other-token" _ = os.Setenv(gitAuthTokenEnvKey, token) expectedValue = &http.BasicAuth{Username: token} - return + return expectedValue }, }, { @@ -168,7 +168,7 @@ func TestGetGitAuth(t *testing.T) { _ = os.Setenv(gitAuthPasswordEnvKey, pass) _ = os.Setenv(gitAuthTokenEnvKey, token) expectedValue = &http.BasicAuth{Username: token} - return + return expectedValue }, }, } diff --git a/pkg/buildcontext/https.go b/pkg/buildcontext/https.go index 3c8f02b40..6a04ae625 100644 --- a/pkg/buildcontext/https.go +++ b/pkg/buildcontext/https.go @@ -43,14 +43,14 @@ func (h *HTTPSTar) UnpackTarFromBuildContext() (directory string, err error) { tarPath := filepath.Join(directory, constants.ContextTar) file, err := util.CreateTargetTarfile(tarPath) if err != nil { - return + return directory, err } // Download tar file from remote https server // and save it into the target tar file resp, err := http.Get(h.context) //nolint:noctx if err != nil { - return + return directory, err } defer func() { if closeErr := resp.Body.Close(); err == nil && closeErr != nil { @@ -69,7 +69,7 @@ func (h *HTTPSTar) UnpackTarFromBuildContext() (directory string, err error) { logrus.Info("Retrieved https tar file") if err = util.UnpackCompressedTar(tarPath, directory); err != nil { - return + return directory, err } logrus.Info("Extracted https tar file") diff --git a/pkg/filesystem/resolve.go b/pkg/filesystem/resolve.go index b0cb9bcea..4cad7edae 100644 --- a/pkg/filesystem/resolve.go +++ b/pkg/filesystem/resolve.go @@ -69,7 +69,7 @@ func ResolvePaths(paths []string, wl []util.IgnoreListEntry) (pathsToAdd []strin if e != nil { if !os.IsNotExist(e) { logrus.Errorf("Couldn't eval %s with link %s", f, link) - return + return pathsToAdd, err } logrus.Tracef("Symlink path %s, target does not exist", f) @@ -94,7 +94,7 @@ func ResolvePaths(paths []string, wl []util.IgnoreListEntry) (pathsToAdd []strin // Also add parent directories to keep the permission of them correctly. pathsToAdd = filesWithParentDirs(pathsToAdd) - return + return pathsToAdd, err } // filesWithParentDirs returns every ancestor path for each provided file path.