aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Barshow <david@datalamb.com>2023-02-07 17:30:05 +0000
committerGopher Robot <gobot@golang.org>2023-02-10 22:21:53 +0000
commitbd5de19b368536574682c45cca9f7864a4eca6d2 (patch)
tree517249a5953dc8bcd46eacad80ba141e231751b0
parent5c5f8dc94793316ebeab24fc3e6cd6340a95df91 (diff)
downloadgo-bd5de19b368536574682c45cca9f7864a4eca6d2.tar.xz
cmd/go: mod vendor: fixed checking for vendor directory
In our case I was using a "vendor-replace" directory which was incorrectly flagged as being in the vendor directory. Change-Id: I8208243ea8416ee7cb4de30e907bcfc25c2d3f27 GitHub-Last-Rev: d183a94d03225ee529c4906a64a289f02eaf7684 GitHub-Pull-Request: golang/go#58287 Reviewed-on: https://go-review.googlesource.com/c/go/+/465036 TryBot-Result: Gopher Robot <gobot@golang.org> Run-TryBot: Bryan Mills <bcmills@google.com> Reviewed-by: Bryan Mills <bcmills@google.com> Reviewed-by: David Chase <drchase@google.com> Auto-Submit: Bryan Mills <bcmills@google.com>
-rw-r--r--src/cmd/go/internal/modcmd/vendor.go2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/cmd/go/internal/modcmd/vendor.go b/src/cmd/go/internal/modcmd/vendor.go
index 2bb2eb8090..78f0e59b8b 100644
--- a/src/cmd/go/internal/modcmd/vendor.go
+++ b/src/cmd/go/internal/modcmd/vendor.go
@@ -211,7 +211,7 @@ func moduleLine(m, r module.Version) string {
b.WriteString(m.Version)
}
if r.Path != "" {
- if strings.HasPrefix(r.Path, "./vendor") || strings.HasPrefix(r.Path, ".\vendor") {
+ if str.HasFilePathPrefix(filepath.Clean(r.Path), "vendor") {
base.Fatalf("go: replacement path %s inside vendor directory", r.Path)
}
b.WriteString(" => ")