@@ -316,6 +316,12 @@ func (f dirFile) Path() string { return f.slashPath }
316
316
func (f dirFile ) Lstat () (os.FileInfo , error ) { return f .info , nil }
317
317
func (f dirFile ) Open () (io.ReadCloser , error ) { return os .Open (f .filePath ) }
318
318
319
+ // isVendoredPackage attempts to report whether the given filename is contained
320
+ // in a package whose import path contains (but does not end with) the component
321
+ // "vendor".
322
+ //
323
+ // Unfortunately, isVendoredPackage reports false positives for files in any
324
+ // non-top-level package whose import path ends in "vendor".
319
325
func isVendoredPackage (name string ) bool {
320
326
var i int
321
327
if strings .HasPrefix (name , "vendor/" ) {
@@ -325,15 +331,8 @@ func isVendoredPackage(name string) bool {
325
331
//
326
332
// i = j + len("/vendor/")
327
333
//
328
- // (See https://golang.org/issue/31562.)
329
- //
330
- // Unfortunately, we can't fix it without invalidating checksums.
331
- // Fortunately, the error appears to be strictly conservative: we'll retain
332
- // vendored packages that we should have pruned, but we won't prune
333
- // non-vendored packages that we should have retained.
334
- //
335
- // Since this defect doesn't seem to break anything, it's not worth fixing
336
- // for now.
334
+ // (See https://golang.org/issue/31562 and https://golang.org/issue/37397.)
335
+ // Unfortunately, we can't fix it without invalidating module checksums.
337
336
i += len ("/vendor/" )
338
337
} else {
339
338
return false
0 commit comments