]> Cypherpunks repositories - gostls13.git/commitdiff
cmd/go: mod vendor: fixed checking for vendor directory
authorDavid Barshow <david@datalamb.com>
Tue, 7 Feb 2023 17:30:05 +0000 (17:30 +0000)
committerGopher Robot <gobot@golang.org>
Fri, 10 Feb 2023 22:21:53 +0000 (22:21 +0000)
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>

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

index 2bb2eb8090aac152ba75f43d7b69a30810c3ddc4..78f0e59b8bbf1e743d326ec2deee36905054ea5e 100644 (file)
@@ -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(" => ")