change copy function name

This commit is contained in:
tongjingran 2020-12-18 19:54:46 +08:00
parent 2493847661
commit a72ede39bd
4 changed files with 8 additions and 8 deletions

View File

@ -53,7 +53,7 @@ func TestModProjectCopyWithUnexistedDir(t *testing.T) {
Pkgs: pkgs, Pkgs: pkgs,
} }
output := captureOutput(b.cpLegacyProject) output := captureOutput(b.cpProject)
assert.Equal(t, strings.Contains(output, "Failed to Copy"), true) assert.Equal(t, strings.Contains(output, "Failed to Copy"), true)
} }

View File

@ -26,7 +26,7 @@ import (
"github.com/qiniu/goc/pkg/cover" "github.com/qiniu/goc/pkg/cover"
) )
func (b *Build) cpLegacyProject() { func (b *Build) cpProject() {
visited := make(map[string]bool) visited := make(map[string]bool)
for k, v := range b.Pkgs { for k, v := range b.Pkgs {
dst := filepath.Join(b.TmpDir, "src", k) dst := filepath.Join(b.TmpDir, "src", k)

View File

@ -25,7 +25,7 @@ import (
"os" "os"
) )
// copy in cpLegacyProject/cpNonStandardLegacy of invalid src, dst name // copy in cpProject of invalid src, dst name
func TestLegacyProjectCopyWithUnexistedDir(t *testing.T) { func TestLegacyProjectCopyWithUnexistedDir(t *testing.T) {
pkgs := make(map[string]*cover.Package) pkgs := make(map[string]*cover.Package)
pkgs["main"] = &cover.Package{ pkgs["main"] = &cover.Package{
@ -42,7 +42,7 @@ func TestLegacyProjectCopyWithUnexistedDir(t *testing.T) {
Pkgs: pkgs, Pkgs: pkgs,
} }
output := captureOutput(b.cpLegacyProject) output := captureOutput(b.cpProject)
assert.Equal(t, strings.Contains(output, "Failed to Copy"), true) assert.Equal(t, strings.Contains(output, "Failed to Copy"), true)
} }
@ -63,7 +63,7 @@ func TestGoModProjectCopyWithUnexistedModFile(t *testing.T) {
IsMod: true, IsMod: true,
} }
output := captureOutput(b.cpLegacyProject) output := captureOutput(b.cpProject)
assert.Equal(t, strings.Contains(output, "Failed to Copy the go mod file"), true) assert.Equal(t, strings.Contains(output, "Failed to Copy the go mod file"), true)
} }

View File

@ -90,9 +90,9 @@ func (b *Build) mvProjectsToTmp() error {
// known cases: // known cases:
// 1. a legacy project, but not in any GOPATH, will cause the b.Root == "" // 1. a legacy project, but not in any GOPATH, will cause the b.Root == ""
if b.IsMod == false && b.Root != "" { if b.IsMod == false && b.Root != "" {
b.cpLegacyProject() b.cpProject()
} else if b.IsMod == true { // go 1.11, 1.12 has no Build.Root } else if b.IsMod == true { // go 1.11, 1.12 has no Build.Root
b.cpLegacyProject() b.cpProject()
updated, newGoModContent, err := b.updateGoModFile() updated, newGoModContent, err := b.updateGoModFile()
if err != nil { if err != nil {
return fmt.Errorf("fail to generate new go.mod: %v", err) return fmt.Errorf("fail to generate new go.mod: %v", err)
@ -107,7 +107,7 @@ func (b *Build) mvProjectsToTmp() error {
} }
} else if b.IsMod == false && b.Root == "" { } else if b.IsMod == false && b.Root == "" {
b.TmpWorkingDir = b.TmpDir b.TmpWorkingDir = b.TmpDir
b.cpLegacyProject() b.cpProject()
} }
log.Infof("New workingdir in tmp directory in: %v", b.TmpWorkingDir) log.Infof("New workingdir in tmp directory in: %v", b.TmpWorkingDir)