Skip to content

Commit 37c117f

Browse files
mattncagedmantis
authored andcommitted
[release-branch.go1.16] 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 #47015 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/+/332329 Reviewed-by: Jay Conrod <[email protected]>
1 parent 4c62fd3 commit 37c117f

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ import (
1313
"io"
1414
"io/fs"
1515
"os"
16+
"path"
1617
"path/filepath"
1718
"sort"
1819
"strings"
@@ -281,7 +282,7 @@ func copyMetadata(modPath, pkg, dst, src string, copiedFiles map[string]bool) {
281282
if modPath == pkg {
282283
break
283284
}
284-
pkg = filepath.Dir(pkg)
285+
pkg = path.Dir(pkg)
285286
dst = filepath.Dir(dst)
286287
src = filepath.Dir(src)
287288
}

0 commit comments

Comments
 (0)