-
Notifications
You must be signed in to change notification settings - Fork 83
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
zip: document isVendoredPackage false-positives
I had thought that the known bug in isVendoredPackage was strictly conservative, but it turns out not to be. Updates golang/go#37397 Updates golang/go#31562 Change-Id: I60f6062c41ec2d116766930f751d7df083535355 Reviewed-on: https://go-review.googlesource.com/c/mod/+/220657 Run-TryBot: Bryan C. Mills <[email protected]> TryBot-Result: Gobot Gobot <[email protected]> Reviewed-by: Jay Conrod <[email protected]>
- Loading branch information
Bryan C. Mills
committed
Feb 24, 2020
1 parent
b0a8b12
commit e5e73c1
Showing
2 changed files
with
47 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
// Copyright 2020 The Go Authors. All rights reserved. | ||
// Use of this source code is governed by a BSD-style | ||
// license that can be found in the LICENSE file. | ||
|
||
package zip | ||
|
||
import "testing" | ||
|
||
func TestIsVendoredPackage(t *testing.T) { | ||
for _, tc := range []struct { | ||
path string | ||
want bool | ||
falsePositive bool // is this case affected by https://golang.org/issue/37397? | ||
}{ | ||
{path: "vendor/foo/foo.go", want: true}, | ||
{path: "pkg/vendor/foo/foo.go", want: true}, | ||
{path: "longpackagename/vendor/foo/foo.go", want: true}, | ||
|
||
{path: "vendor/vendor.go", want: false}, | ||
|
||
// We ideally want these cases to be false, but they are affected by | ||
// https://golang.org/issue/37397, and if we fix them we will invalidate | ||
// existing module checksums. We must leave them as-is-for now. | ||
{path: "pkg/vendor/vendor.go", falsePositive: true}, | ||
{path: "longpackagename/vendor/vendor.go", falsePositive: true}, | ||
} { | ||
got := isVendoredPackage(tc.path) | ||
want := tc.want | ||
if tc.falsePositive { | ||
want = true | ||
} | ||
if got != want { | ||
t.Errorf("isVendoredPackage(%q) = %t; want %t", tc.path, got, tc.want) | ||
if tc.falsePositive { | ||
t.Logf("(Expected a false-positive due to https://golang.org/issue/37397.)") | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters