]> Cypherpunks repositories - gostls13.git/commitdiff
cmd/go/internal/modfetch: comment on known bug in isVendoredPackage
authorBryan C. Mills <bcmills@google.com>
Fri, 19 Apr 2019 14:15:58 +0000 (10:15 -0400)
committerBryan C. Mills <bcmills@google.com>
Fri, 19 Apr 2019 18:08:17 +0000 (18:08 +0000)
Fixes #31562

Change-Id: Ida30dd8071eccb6b490ab89a1de087038fe26796
Reviewed-on: https://go-review.googlesource.com/c/go/+/172977
Run-TryBot: Bryan C. Mills <bcmills@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Jay Conrod <jayconrod@google.com>
src/cmd/go/internal/modfetch/coderepo.go

index 7aedf1d8615ab76d11bcd4abc1911848125cb0ca..3581f93fe7ecc767379717a3ff50c7f19e30a158 100644 (file)
@@ -634,6 +634,19 @@ func isVendoredPackage(name string) bool {
        if strings.HasPrefix(name, "vendor/") {
                i += len("vendor/")
        } else if j := strings.Index(name, "/vendor/"); j >= 0 {
+               // This offset looks incorrect; this should probably be
+               //
+               //      i = j + len("/vendor/")
+               //
+               // (See https://golang.org/issue/31562.)
+               //
+               // Unfortunately, we can't fix it without invalidating checksums.
+               // Fortunately, the error appears to be strictly conservative: we'll retain
+               // vendored packages that we should have pruned, but we won't prune
+               // non-vendored packages that we should have retained.
+               //
+               // Since this defect doesn't seem to break anything, it's not worth fixing
+               // for now.
                i += len("/vendor/")
        } else {
                return false