]> Cypherpunks repositories - gostls13.git/commitdiff
[release-branch.go1.16] cmd/go: use path.Dir instead of filepath.Dir for package...
authorYasuhiro Matsumoto <mattn.jp@gmail.com>
Tue, 22 Jun 2021 16:02:33 +0000 (01:02 +0900)
committerCarlos Amedee <carlos@golang.org>
Tue, 3 Aug 2021 15:00:47 +0000 (15:00 +0000)
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 <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>
(cherry picked from commit 835d86a17ebf32a3cb081f66119c74363dbd8825)
Reviewed-on: https://go-review.googlesource.com/c/go/+/332329
Reviewed-by: Jay Conrod <jayconrod@google.com>
src/cmd/go/internal/modcmd/vendor.go

index ac1fb7720aad4c86e86cfab8a9193fcad4bde4ed..4ef8481b43cd866c99192c40c724ff55b4111e00 100644 (file)
@@ -13,6 +13,7 @@ import (
        "io"
        "io/fs"
        "os"
+       "path"
        "path/filepath"
        "sort"
        "strings"
@@ -281,7 +282,7 @@ func copyMetadata(modPath, pkg, dst, src string, copiedFiles map[string]bool) {
                if modPath == pkg {
                        break
                }
-               pkg = filepath.Dir(pkg)
+               pkg = path.Dir(pkg)
                dst = filepath.Dir(dst)
                src = filepath.Dir(src)
        }