gopls/benchmark: skip unimported completion if not local
This benchmark should only be run locally, where there is a usable
module cache (and index). Also, it had an obsolete calculation of
the location of the index.
For context, see
https://github.com/golang/go/issues/76873#issuecomment-3667491422
diff --git a/gopls/internal/test/integration/bench/unimported_test.go b/gopls/internal/test/integration/bench/unimported_test.go
index baa1d3c..8d4d945 100644
--- a/gopls/internal/test/integration/bench/unimported_test.go
+++ b/gopls/internal/test/integration/bench/unimported_test.go
@@ -22,6 +22,7 @@
// experiments show the new code about 15 times faster than the old,
// and the old code sometimes fails to find the completion
func BenchmarkLocalModcache(b *testing.B) {
+ b.Skip("only run by hand")
budgets := []string{"0s", "100ms", "200ms", "500ms", "1s", "5s"}
sources := []string{"gopls", "goimports"}
for _, budget := range budgets {
@@ -99,7 +100,7 @@
// Check that completion works as expected
env.CreateBuffer("main.go", mainfile)
env.AfterChange()
- if false { // warm up? or not?
+ if true { // with true, reveals failutes
loc := env.RegexpSearch("main.go", name)
completions := env.Completion(loc)
if len(completions.Items) == 0 {
@@ -153,6 +154,6 @@
if err != nil {
t.Fatalf("os.UserCacheDir: %v", err)
}
- dir = filepath.Join(dir, "go", "imports")
+ dir = filepath.Join(dir, "goimports")
modindex.IndexDir = dir
}
diff --git a/internal/modindex/index.go b/internal/modindex/index.go
index c41d1dd..94bae4a 100644
--- a/internal/modindex/index.go
+++ b/internal/modindex/index.go
@@ -107,7 +107,7 @@
var err error
dir, err = os.UserCacheDir()
// shouldn't happen, but TempDir is better than
- // creating ./go/imports
+ // creating ./goimports
if err != nil {
dir = os.TempDir()
}
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
b.Skip("only run by hand")Let's be specific about why this can only be run "by hand", or more accurately, locally after some sequence of setup steps documented somewhere.
if true { // with true, reveals failutesSimplify? (Why would one not want to see failures?)
(BTW: typo)
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
Let's be specific about why this can only be run "by hand", or more accurately, locally after some sequence of setup steps documented somewhere.
Done
Simplify? (Why would one not want to see failures?)
(BTW: typo)
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
| Code-Review | +2 |
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |