Closed
Description
Reproduces with gopls@master
and gopls@latest
:
golang.org/x/tools/gopls v0.1.0
golang.org/x/tools/gopls@v0.1.2-0.20190708203411-c8855242db9c h1:qFHl9H1pFOvam5c7rRNiSVPuASu5sS/VNZUj7KNAyGI=
and
$ gopls version
golang.org/x/tools/gopls v0.1.0
golang.org/x/tools/gopls@v0.1.1 h1:mU/O8r53RjzdZfkqmFOX4iEt8PJxTPXyLdiuQNa27OE=
Steps to reproduce:
- Create folder
- Create a.go:
package main type whatever struct{}
- Create b.go:
package main import "fmt" func main() { w := whatever{} fmt.Println("whatever", w) }
This compiles and runs fine, but in vscode with gopls I get a red squiggly over package
with the error:
file:///usr/local/google/home/deklerk/workspace/interview-questions/foo/b.go is not part of a package LSP
Metadata
Metadata
Assignees
Type
Projects
Relationships
Development
No branches or pull requests
Activity
stamblerre commentedon Jul 9, 2019
Are you able to reproduce this if the package name is not
main
?jeanbza commentedon Jul 9, 2019
IIRC yes - I actually found it on a non-main package and recreated it with main.
[-]gopls: file is not part of package[/-][+]x/tools/cmd/gopls: file is not part of package[/+]llbec commentedon Jul 10, 2019
I got this error too. This error has gone when I reopen vscode, but it will come out at an other new open file.
stamblerre commentedon Jul 10, 2019
@llbox: What version of
gopls
are you using (gopls version
)? Can you update to the latest version (go get golang.org/x/tools/gopls@latest
) and confirm that you still see this issue?mthie commentedon Jul 10, 2019
Even after
git pull
on master branch the message still occurs. Also invim-go
.jamiebarnett commentedon Jul 11, 2019
I am also having this issue. Compiles fine but get an error that won't go away unless VS Code is restarted. from VS Code gopls log;
linguohua commentedon Jul 11, 2019
version v0.1.3-cmd.gopls, built in $GOPATH mode.
Has the same problem both on windows and linux
mthie commentedon Jul 11, 2019
When I check it manually, not via IDE:
malexdev commentedon Jul 11, 2019
I am also having this issue.
Sometimes restarting the language server will resolve the issue, but then it will come back seemingly at random. The only thing that seems to permanently resolve the issue for a newly created file is to reload VS Code.
This is using modules.
stamblerre commentedon Jul 11, 2019
@mthie, @jamiebarnett, @linguohua, @malexdev - could you share a full
gopls
log? It would be easier for me to understand the issue to see a log that starts from the beginning. Also, if you are using VSCode, please share your VSCode settings.mthie commentedon Jul 11, 2019
Well, I thought, I already posted the full log ;)
Here's a verbose output:
stamblerre commentedon Jul 11, 2019
Thanks for sharing all of it, I didn't realize you were using
gopls
on the command line. What happens when you rungo list -e -json -compiled -test /home/mthie/go/src/github.com/mthie/mylib
?29 remaining items