add more tests
This commit is contained in:
parent
ed94132080
commit
f5a54cf6bb
|
@ -1845,7 +1845,7 @@ func getRewritePath(pkg string, gopath string, depRoot string) string {
|
|||
// Get the package name
|
||||
// This is the value after "github.com/foo/bar"
|
||||
repoName := splitPkg[2]
|
||||
basePath := filepath.Base(sanitizedPkg)
|
||||
basePath := splitPkg[len(splitPkg)-1]
|
||||
if basePath == repoName {
|
||||
depParts = append([]string{depRoot, repoName})
|
||||
} else {
|
||||
|
|
|
@ -93,4 +93,9 @@ func TestDepRootCalc(t *testing.T) {
|
|||
dep = getRewritePath("github.com/example/foo/v2", "/gopath", "/my-go-src")
|
||||
assert.Equal(t, "/my-go-src/foo", dep)
|
||||
|
||||
dep = getRewritePath("github.com/example/foo", "/gopath", "/my-go-src")
|
||||
assert.Equal(t, "/my-go-src/foo", dep)
|
||||
|
||||
dep = getRewritePath("github.com/pulumi/pulumi-auth0/sdk", "gopath", "/my-go-src")
|
||||
assert.Equal(t, "/my-go-src/pulumi-auth0/sdk", dep)
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue