Skip to content

Commit 1b68e07

Browse files
mattncagedmantis
authored andcommitted
[release-branch.go1.15] cmd/go: use path.Dir instead of filepath.Dir for package paths in 'go mod vendor'
copyMetadata walk-up to parent directory until the pkg become modPath. But pkg should be slash-separated paths. It have to use path.Dir instead of filepath.Dir. Updates #46867 Fixes #47014 Change-Id: I44cf1429fe52379a7415b94cc30ae3275cc430e8 Reviewed-on: https://go-review.googlesource.com/c/go/+/330149 Reviewed-by: Bryan C. Mills <[email protected]> Trust: Bryan C. Mills <[email protected]> Trust: Alexander Rakoczy <[email protected]> Trust: Carlos Amedee <[email protected]> Run-TryBot: Bryan C. Mills <[email protected]> TryBot-Result: Go Bot <[email protected]> (cherry picked from commit 835d86a) Reviewed-on: https://go-review.googlesource.com/c/go/+/332330 Reviewed-by: Jay Conrod <[email protected]> Run-TryBot: Carlos Amedee <[email protected]>
1 parent 818c5f6 commit 1b68e07

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/cmd/go/internal/modcmd/vendor.go

+2-1
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ import (
1010
"io"
1111
"io/ioutil"
1212
"os"
13+
"path"
1314
"path/filepath"
1415
"sort"
1516
"strings"
@@ -192,7 +193,7 @@ func copyMetadata(modPath, pkg, dst, src string) {
192193
if modPath == pkg {
193194
break
194195
}
195-
pkg = filepath.Dir(pkg)
196+
pkg = path.Dir(pkg)
196197
dst = filepath.Dir(dst)
197198
src = filepath.Dir(src)
198199
}

0 commit comments

Comments
 (0)