Skip to content

Commit 835d86a

Browse files
mattnBryan C. Mills
authored andcommitted
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. Fixes #46867 Change-Id: I44cf1429fe52379a7415b94cc30ae3275cc430e8 Reviewed-on: https://go-review.googlesource.com/c/go/+/330149 Reviewed-by: Bryan C. Mills <bcmills@google.com> Trust: Bryan C. Mills <bcmills@google.com> Trust: Alexander Rakoczy <alex@golang.org> Trust: Carlos Amedee <carlos@golang.org> Run-TryBot: Bryan C. Mills <bcmills@google.com> TryBot-Result: Go Bot <gobot@golang.org>
1 parent eb437ba commit 835d86a

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"
@@ -299,7 +300,7 @@ func copyMetadata(modPath, pkg, dst, src string, copiedFiles map[string]bool) {
299300
if modPath == pkg {
300301
break
301302
}
302-
pkg = filepath.Dir(pkg)
303+
pkg = path.Dir(pkg)
303304
dst = filepath.Dir(dst)
304305
src = filepath.Dir(src)
305306
}

0 commit comments

Comments
 (0)