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/go/packages: new packages in overlays don't work for modules #33482

Closed
stamblerre opened this issue Aug 5, 2019 · 2 comments
Closed
Labels
FrozenDueToAge gopls Issues related to the Go language server, gopls. modules NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Milestone

Comments

@stamblerre
Copy link
Contributor

Forked from #31467.
This is only applicable to modules, as it works fine in $GOPATH mode.

To reproduce, create a directory foo outside of your $GOPATH.
Open foo in VSCode (using gopls), then create file foo.go, but do not save it.
Add some code like

package foo

import (
	"fmt"
)

func _() {
	fmt.Println()
}

gopls will not provide autocompletion for this file because go/packages will not return a valid package. The reason for this is that there are no rootDirs in this case: https://github.com/golang/tools/blob/c5a2fd39b72a2403dae32d544b008ff4973c8b29/go/packages/golist_overlay.go#L78, so the pkgPath will never be set.

/cc @matloob

@stamblerre stamblerre added the NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. label Aug 5, 2019
@gopherbot gopherbot added this to the Unreleased milestone Aug 5, 2019
@stamblerre stamblerre added the gopls Issues related to the Go language server, gopls. label Aug 5, 2019
@gopherbot
Copy link

Change https://golang.org/cl/189217 mentions this issue: go/packages: test for golang/go#33482

gopherbot pushed a commit to golang/tools that referenced this issue Aug 6, 2019
Updates golang/go#33482

Change-Id: Ib24a0b955694455ddf1fc31011d57a7d797519ae
Reviewed-on: https://go-review.googlesource.com/c/tools/+/189217
Run-TryBot: Rebecca Stambler <rstambler@golang.org>
Reviewed-by: Michael Matloob <matloob@golang.org>
@gopherbot
Copy link

Change https://golang.org/cl/189322 mentions this issue: go/packages: handle ad-hoc overlays with sources outside modules

@golang golang locked and limited conversation to collaborators Aug 7, 2020
@rsc rsc unassigned matloob Jun 23, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
FrozenDueToAge gopls Issues related to the Go language server, gopls. modules NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Projects
None yet
Development

No branches or pull requests

4 participants