Skip to content
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

x/tools/gopls: autocompletion after import organization fails with in-package tests #34379

Closed
stamblerre opened this issue Sep 18, 2019 · 3 comments
Closed

Comments

@stamblerre
Copy link
Contributor

@stamblerre stamblerre commented Sep 18, 2019

This reproduces with the latest gopls version.

Small repro:

package simple

func Simple() {
    <autocomplete http and try to do completions (they will fail)>
}
package simple

import "testing"

func TestSimple(t *testing.T) {
    <autocomplete http and try to do completions (they will succeed)>
}
@stamblerre

This comment has been minimized.

Copy link
Contributor Author

@stamblerre stamblerre commented Sep 18, 2019

This appears to be caused by go/packages erroneously reporting the net/http import as a dependency of only the test variant of the package, and not the non-test variant. This probably relates mostly to go/packages's handling of overlays.

@gopherbot

This comment has been minimized.

Copy link

@gopherbot gopherbot commented Sep 18, 2019

Change https://golang.org/cl/196259 mentions this issue: go/packages: fix overlay deps for packages with test variants

@gopherbot

This comment has been minimized.

Copy link

@gopherbot gopherbot commented Sep 18, 2019

Change https://golang.org/cl/196279 mentions this issue: [gopls-release-branch.0.1] go/packages: fix overlay deps for packages with test variants

gopherbot pushed a commit to golang/tools that referenced this issue Sep 18, 2019
… with test variants

This change handles the case when an import gets added in an overlay a
package with a test variant. Previously, we would only add that
dependency to the test variant of the package.

Fixes golang/go#34379

Change-Id: I82c3d72d7c2d0b970fb27c1aea5be71783b83764
Reviewed-on: https://go-review.googlesource.com/c/tools/+/196259
Run-TryBot: Rebecca Stambler <rstambler@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Michael Matloob <matloob@golang.org>
(cherry picked from commit 2c1181b)
Reviewed-on: https://go-review.googlesource.com/c/tools/+/196279
Reviewed-by: Ian Cottrell <iancottrell@google.com>
clintjedwards added a commit to clintjedwards/tools that referenced this issue Sep 19, 2019
This change handles the case when an import gets added in an overlay a
package with a test variant. Previously, we would only add that
dependency to the test variant of the package.

Fixes golang/go#34379

Change-Id: I82c3d72d7c2d0b970fb27c1aea5be71783b83764
Reviewed-on: https://go-review.googlesource.com/c/tools/+/196259
Run-TryBot: Rebecca Stambler <rstambler@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Michael Matloob <matloob@golang.org>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants
You can’t perform that action at this time.