-
Notifications
You must be signed in to change notification settings - Fork 17.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
cmd/go: go test in a directory without any test files uses network access to try to fetch the source for the code running locally #32917
Comments
The underlying cause is likely the same as #28459, but I'm going to leave this one open since the failure mode is somewhat different. |
This certainly needs to be fixed, but a proper fix is fairly invasive (and probably best left for 1.14). I think it is important that we at least eliminate the network access for 1.13, but the error message will probably be abysmal. (CC @jayconrod in case he disagrees or can spot a simpler robust fix.) |
Can we actually avoid going out to the network without breaking existing behavior? Suppose the main module is Sorry this is a contrived example, but as long as we allow packages to be provided by any module whose path is a prefix, I think we'll have this problem. |
I disagree. In general, we only allow paths starting with |
We could fix this by requiring relative paths to be packages in the main module. It looks like if a relative path contains a wildcard, we expand it to paths in the main module containing go files, and we won't go out to the network. If a path does not contain a wildcard, we join it with the module path without checking if anything is there, treating it as a full package path thereafter. So currently, |
Yes. The tricky part is the |
I think I've spotted a simple fix for 1.13. Will send a CL tomorrow (assuming it works out). |
Change https://golang.org/cl/185344 mentions this issue: |
Change https://golang.org/cl/185343 mentions this issue: |
Change https://golang.org/cl/185345 mentions this issue: |
Change https://golang.org/cl/185417 mentions this issue: |
…the Target module Updates #28459 Updates #32917 Change-Id: Iced562cb7c2e0ac075d8345f1e4ad3b073842dcf Reviewed-on: https://go-review.googlesource.com/c/go/+/185343 Run-TryBot: Bryan C. Mills <[email protected]> TryBot-Result: Gobot Gobot <[email protected]> Reviewed-by: Jay Conrod <[email protected]>
Change https://golang.org/cl/221458 mentions this issue: |
Previously, we would either invoke base.Fatalf (which is too aggressive), or log.Print (which is too passive). Updates #32917 Change-Id: I5475e873e76948de7df65dca08bc0ce67a7fc827 Reviewed-on: https://go-review.googlesource.com/c/go/+/185344 Run-TryBot: Bryan C. Mills <[email protected]> TryBot-Result: Gobot Gobot <[email protected]> Reviewed-by: Jay Conrod <[email protected]>
…atch methods This change consolidates predicates currently scattered throughout various parts of the package and module loader into methods on the search.Match type. That not only makes them more concise, but also encourages consistency, both in the code and in reasoning about the kinds of patterns that need to be handled. (For example, the IsLocal predicate was previously two different calls, either of which could be easily forgotten at a given call site.) Factored out from CL 185344 and CL 185345. Updates #32917 Change-Id: Ifa450ffaf6101f673e0ed69ced001a487d6f9335 Reviewed-on: https://go-review.googlesource.com/c/go/+/221458 Run-TryBot: Bryan C. Mills <[email protected]> TryBot-Result: Gobot Gobot <[email protected]> Reviewed-by: Michael Matloob <[email protected]> Reviewed-by: Jay Conrod <[email protected]>
This change is a non-minimal fix for #32917, but incidentally fixes several other bugs and makes the error messages much more ergonomic. Updates #32917 Updates #27122 Updates #28459 Updates #29280 Updates #30590 Updates #37214 Updates #36173 Updates #36587 Fixes #36008 Fixes #30992 Change-Id: Iedb26d2e0963697c130df5d0f72e7f83ec2dcf06 Reviewed-on: https://go-review.googlesource.com/c/go/+/185345 Reviewed-by: Michael Matloob <[email protected]> Reviewed-by: Jay Conrod <[email protected]>
What version of Go are you using (
go version
)?Does this issue reproduce with the latest release?
yes
What operating system and processor architecture are you using (
go env
)?go env
OutputWhat did you do?
What did you expect to see?
A message about no test files for the package.
What did you see instead?
The go tool is accessing a network service to try to fetch the source code for the package I am currently in.
The text was updated successfully, but these errors were encountered: