From a72ede39bd169fe25aa5db2ca708897a2ea892a9 Mon Sep 17 00:00:00 2001 From: tongjingran Date: Fri, 18 Dec 2020 19:54:46 +0800 Subject: [PATCH] change copy function name --- pkg/build/gomodules_test.go | 2 +- pkg/build/legacy.go | 2 +- pkg/build/legacy_test.go | 6 +++--- pkg/build/tmpfolder.go | 6 +++--- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/pkg/build/gomodules_test.go b/pkg/build/gomodules_test.go index c629ec3..38d7e05 100644 --- a/pkg/build/gomodules_test.go +++ b/pkg/build/gomodules_test.go @@ -53,7 +53,7 @@ func TestModProjectCopyWithUnexistedDir(t *testing.T) { Pkgs: pkgs, } - output := captureOutput(b.cpLegacyProject) + output := captureOutput(b.cpProject) assert.Equal(t, strings.Contains(output, "Failed to Copy"), true) } diff --git a/pkg/build/legacy.go b/pkg/build/legacy.go index 6eca135..4b47fda 100644 --- a/pkg/build/legacy.go +++ b/pkg/build/legacy.go @@ -26,7 +26,7 @@ import ( "github.com/qiniu/goc/pkg/cover" ) -func (b *Build) cpLegacyProject() { +func (b *Build) cpProject() { visited := make(map[string]bool) for k, v := range b.Pkgs { dst := filepath.Join(b.TmpDir, "src", k) diff --git a/pkg/build/legacy_test.go b/pkg/build/legacy_test.go index a6a01dd..48bfd6d 100644 --- a/pkg/build/legacy_test.go +++ b/pkg/build/legacy_test.go @@ -25,7 +25,7 @@ import ( "os" ) -// copy in cpLegacyProject/cpNonStandardLegacy of invalid src, dst name +// copy in cpProject of invalid src, dst name func TestLegacyProjectCopyWithUnexistedDir(t *testing.T) { pkgs := make(map[string]*cover.Package) pkgs["main"] = &cover.Package{ @@ -42,7 +42,7 @@ func TestLegacyProjectCopyWithUnexistedDir(t *testing.T) { Pkgs: pkgs, } - output := captureOutput(b.cpLegacyProject) + output := captureOutput(b.cpProject) assert.Equal(t, strings.Contains(output, "Failed to Copy"), true) } @@ -63,7 +63,7 @@ func TestGoModProjectCopyWithUnexistedModFile(t *testing.T) { IsMod: true, } - output := captureOutput(b.cpLegacyProject) + output := captureOutput(b.cpProject) assert.Equal(t, strings.Contains(output, "Failed to Copy the go mod file"), true) } diff --git a/pkg/build/tmpfolder.go b/pkg/build/tmpfolder.go index 3c6a8f1..ee76c9d 100644 --- a/pkg/build/tmpfolder.go +++ b/pkg/build/tmpfolder.go @@ -90,9 +90,9 @@ func (b *Build) mvProjectsToTmp() error { // known cases: // 1. a legacy project, but not in any GOPATH, will cause the 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 - b.cpLegacyProject() + b.cpProject() updated, newGoModContent, err := b.updateGoModFile() if err != nil { 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 == "" { b.TmpWorkingDir = b.TmpDir - b.cpLegacyProject() + b.cpProject() } log.Infof("New workingdir in tmp directory in: %v", b.TmpWorkingDir)