internal/lsp/source: don't unconditionally name imports

In CL 205501 I thoughtlessly set import name to package name, but really
we only want to name imports when goimports would do it. For now, it's
better to not name them and let the usual imports code add a name if

Fixes golang/go#35397.

Change-Id: Id0df866f95e5e86ed72b25fbd1a7224c79ee8084
Run-TryBot: Heschi Kreinick <>
TryBot-Result: Gobot Gobot <>
Reviewed-by: Rebecca Stambler <>
(cherry picked from commit c2ac6c2a2d7ef39f1c4c195d1cd731098986857f)
Reviewed-by: Heschi Kreinick <>
diff --git a/internal/lsp/source/completion.go b/internal/lsp/source/completion.go
index 2b79350..5088762 100644
--- a/internal/lsp/source/completion.go
+++ b/internal/lsp/source/completion.go
@@ -730,7 +730,6 @@
 					obj := types.NewPkgName(0, nil, pkg.Name(), pkg)
 					c.found(obj, stdScore, &importInfo{
 						importPath: pkg.Path(),
-						name:       pkg.Name(),