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: error loading workspace #54193

Closed
WockaFlockaRist opened this issue Aug 2, 2022 · 5 comments
Closed

x/tools/gopls: error loading workspace #54193

WockaFlockaRist opened this issue Aug 2, 2022 · 5 comments
Labels
FrozenDueToAge gopls Issues related to the Go language server, gopls. Tools This label describes issues relating to any tools in the x/tools repository. WaitingForInfo Issue is not actionable because of missing required information, which needs to be provided.
Milestone

Comments

@WockaFlockaRist
Copy link

WockaFlockaRist commented Aug 2, 2022

##What version of Go are you using (go version)?
1.18.4-1

##What operating system and processor architecture are you using?
OS: Manjaro Linux x86_64
CPU: Intel i7-8650U (8) @ 4.200GHz

##What did you do?
Worked on a project on friday, updated my system before I left work. Including VSCode and GOlang.

##What did you expect to see?
No errors on my toolbar,

##What did you see instead?
When I open projects where I have imported modules from remote sources I get a red underline under the import line and a Problem report in the problems-tab.

could not import github.com/pkg/sftp (cannot find package "github.com/pkg/sftp" in any of 
	/usr/lib/go/src/github.com/pkg/sftp (from $GOROOT)
	/home/username/go/src/github.com/pkg/sftp (from $GOPATH))

The errors occurs after I open the folder from the dropdown menu.

Also accompanied by this message:
Error loading workspace: You are outside of a module and outside of $GOPATH/src. If you are using modules, please open your editor to a directory in your module. If you believe this warning is incorrect, please file an issue: https://github.com/golang/go/issues/new.

Which is true, I am not in that folder, but I have never worked in that folder and never had errors before. Moving my workspace to $GOPATH/src removes the message, but the problem reports and visual red underlines on the import statements are still present.

I have no errors compiling the programs, so this is a bug in Visual Studio.

@findleyr findleyr changed the title Error loading workspace x/tools/gopls: error loading workspace Aug 2, 2022
@gopherbot gopherbot added Tools This label describes issues relating to any tools in the x/tools repository. gopls Issues related to the Go language server, gopls. labels Aug 2, 2022
@findleyr findleyr removed the Tools This label describes issues relating to any tools in the x/tools repository. label Aug 2, 2022
@gopherbot gopherbot added this to the Unreleased milestone Aug 2, 2022
@findleyr findleyr added the Tools This label describes issues relating to any tools in the x/tools repository. label Aug 2, 2022
@WockaFlockaRist
Copy link
Author

WockaFlockaRist commented Aug 3, 2022

[Info - 09:32:24] 2022/08/03 09:32:23 falling back to safe trimming due to type errors: [/usr/lib/go/src/runtime/vdso_linux.go:53:38: invalid operation: division by zero /usr/lib/go/src/runtime/vdso_linux.go:54:38: invalid operation: division by zero] or still-missing identifiers: map[memRecordCycle:true pageBits:true]
package="runtime"

[Error - 09:32:24] 2022/08/03 09:32:24 errors loading workspace: You are outside of a module and outside of $GOPATH/src.
If you are using modules, please open your editor to a directory in your module.
If you believe this warning is incorrect, please file an issue: https://github.com/golang/go/issues/new.
snapshot=1
directory=file:///home/user/go/gocode

Log from GO Language Server

@WockaFlockaRist
Copy link
Author

I updated GO to 1.19, seemed to have no effect.
However I disabled the Go Language Server(GOPLS) and I dont see the errors anymore.

If you want to look more into this, please keep this. But for my part the issues is resolved by just not using the product.

@findleyr
Copy link
Contributor

findleyr commented Aug 3, 2022

We would like to understand why this regressed for you. Not using gopls is going to lead to an inferior experience in many other ways.

If I understand correctly, you are not in GOPATH, and do not have a go.mod file? If so, I am not sure how your build is working. Can you tell us any more information about the workspace?

@findleyr findleyr added the WaitingForInfo Issue is not actionable because of missing required information, which needs to be provided. label Aug 3, 2022
@WockaFlockaRist
Copy link
Author

I do have a go.mod file and the project builds fine.

I was not originally in GOPATH, but moving the project to GOPATH removed the error, but gopls did not find my modules, even though the project was building fine.

However, after updating and re-installing all tools on GO 1.19 this seems to work fine now.

@findleyr
Copy link
Contributor

findleyr commented Aug 4, 2022

Ok, thanks. If things are working now I'll close this.

What do you mean exactly by "gopls did not find my modules": modules are defined by a go.mod file.

@findleyr findleyr closed this as completed Aug 4, 2022
@golang golang locked and limited conversation to collaborators Aug 4, 2023
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. Tools This label describes issues relating to any tools in the x/tools repository. WaitingForInfo Issue is not actionable because of missing required information, which needs to be provided.
Projects
None yet
Development

No branches or pull requests

3 participants