cmd/go/internal/modfetch: comment on known bug in isVendoredPackage

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>
This commit is contained in:
Bryan C. Mills 2019-04-19 10:15:58 -04:00
parent 64e29f94e2
commit 47150aafbf

View File

@ -634,6 +634,19 @@ func isVendoredPackage(name string) bool {
if strings.HasPrefix(name, "vendor/") { if strings.HasPrefix(name, "vendor/") {
i += len("vendor/") i += len("vendor/")
} else if j := strings.Index(name, "/vendor/"); j >= 0 { } 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/") i += len("/vendor/")
} else { } else {
return false return false