diff --git a/cli/command/image/build/internal/git/gitutils.go b/cli/command/image/build/internal/git/gitutils.go index f9b2b4b9c4..4270e86ef5 100644 --- a/cli/command/image/build/internal/git/gitutils.go +++ b/cli/command/image/build/internal/git/gitutils.go @@ -35,7 +35,6 @@ func WithIsolatedConfig(v bool) CloneOption { // will be under "docker-build-git" func Clone(remoteURL string, opts ...CloneOption) (string, error) { repo, err := parseRemoteURL(remoteURL) - if err != nil { return "", err } diff --git a/cli/command/image/build/internal/git/gitutils_test.go b/cli/command/image/build/internal/git/gitutils_test.go index f3c67b3021..e09a7601fc 100644 --- a/cli/command/image/build/internal/git/gitutils_test.go +++ b/cli/command/image/build/internal/git/gitutils_test.go @@ -239,11 +239,11 @@ func TestCheckoutGit(t *testing.T) { must(gitRepo{}.gitWithinDir(root, "-c", "init.defaultBranch=master", "init", gitDir)) must(gitRepo{}.gitWithinDir(gitDir, "config", "user.email", "test@docker.com")) must(gitRepo{}.gitWithinDir(gitDir, "config", "user.name", "Docker test")) - assert.NilError(t, os.WriteFile(filepath.Join(gitDir, "Dockerfile"), []byte("FROM scratch"), 0644)) + assert.NilError(t, os.WriteFile(filepath.Join(gitDir, "Dockerfile"), []byte("FROM scratch"), 0o644)) subDir := filepath.Join(gitDir, "subdir") - assert.NilError(t, os.Mkdir(subDir, 0755)) - assert.NilError(t, os.WriteFile(filepath.Join(subDir, "Dockerfile"), []byte("FROM scratch\nEXPOSE 5000"), 0644)) + assert.NilError(t, os.Mkdir(subDir, 0o755)) + assert.NilError(t, os.WriteFile(filepath.Join(subDir, "Dockerfile"), []byte("FROM scratch\nEXPOSE 5000"), 0o644)) if runtime.GOOS != "windows" { assert.NilError(t, os.Symlink("../subdir", filepath.Join(gitDir, "parentlink"))) @@ -254,8 +254,8 @@ func TestCheckoutGit(t *testing.T) { must(gitRepo{}.gitWithinDir(gitDir, "commit", "-am", "First commit")) must(gitRepo{}.gitWithinDir(gitDir, "checkout", "-b", "test")) - assert.NilError(t, os.WriteFile(filepath.Join(gitDir, "Dockerfile"), []byte("FROM scratch\nEXPOSE 3000"), 0644)) - assert.NilError(t, os.WriteFile(filepath.Join(subDir, "Dockerfile"), []byte("FROM busybox\nEXPOSE 5000"), 0644)) + assert.NilError(t, os.WriteFile(filepath.Join(gitDir, "Dockerfile"), []byte("FROM scratch\nEXPOSE 3000"), 0o644)) + assert.NilError(t, os.WriteFile(filepath.Join(subDir, "Dockerfile"), []byte("FROM busybox\nEXPOSE 5000"), 0o644)) must(gitRepo{}.gitWithinDir(gitDir, "add", "-A")) must(gitRepo{}.gitWithinDir(gitDir, "commit", "-am", "Branch commit")) @@ -267,7 +267,7 @@ func TestCheckoutGit(t *testing.T) { must(gitRepo{}.gitWithinDir(subrepoDir, "config", "user.email", "test@docker.com")) must(gitRepo{}.gitWithinDir(subrepoDir, "config", "user.name", "Docker test")) - assert.NilError(t, os.WriteFile(filepath.Join(subrepoDir, "subfile"), []byte("subcontents"), 0644)) + assert.NilError(t, os.WriteFile(filepath.Join(subrepoDir, "subfile"), []byte("subcontents"), 0o644)) must(gitRepo{}.gitWithinDir(subrepoDir, "add", "-A")) must(gitRepo{}.gitWithinDir(subrepoDir, "commit", "-am", "Subrepo initial"))