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: Warning in VS code: Error loading workspace #46664

Closed
cvq opened this issue Jun 9, 2021 · 8 comments
Closed

x/tools/gopls: Warning in VS code: Error loading workspace #46664

cvq opened this issue Jun 9, 2021 · 8 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.

Comments

@cvq
Copy link

cvq commented Jun 9, 2021

What version of Go are you using (go version)?

$ go version
1.16.5

Does this issue reproduce with the latest release?

What operating system and processor architecture are you using (go env)?

windows, amd64go env Output
$ go env

windows, amd64

What did you do?

go env -w GO111MODULE=auto
install lidrary: go get github.com/AllenDang/giu@master

What did you expect to see?

What did you see instead?

VS Code Warning: 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.

@seankhliao seankhliao changed the title Warning in VS code: Error loading workspace x/tools/gopls: Warning in VS code: Error loading workspace Jun 9, 2021
@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 Jun 9, 2021
@gopherbot gopherbot added this to the Unreleased milestone Jun 9, 2021
@seankhliao
Copy link
Member

which directory did you open vs code in?

@seankhliao seankhliao added the WaitingForInfo Issue is not actionable because of missing required information, which needs to be provided. label Jun 9, 2021
@cvq
Copy link
Author

cvq commented Jun 9, 2021

it is my app directory like: "E:\MyProjects\GuiApp

@findleyr
Copy link
Contributor

findleyr commented Jun 9, 2021

Does that directory have a go.mod file? Can you build your app?

@findleyr findleyr modified the milestones: Unreleased, gopls/unplanned Jun 9, 2021
@cvq
Copy link
Author

cvq commented Jun 9, 2021

There is no "go.mod". I can build my app using "go build".

@findleyr
Copy link
Contributor

findleyr commented Jun 9, 2021

How exactly are you running go build? go build foo.go will still work without a module, but gopls does not have good support for single-file mode.

In any case, the correct solution to your problem is probably to create a module. See go help modules for more information on how to do this.

@keides2
Copy link

keides2 commented Jun 11, 2021

I also have the same go version go1.16.5 and the same error.
image

@keides2
Copy link

keides2 commented Jun 11, 2021

The error disappeared by following the steps below.
Open the $GOPATH/src folder once and recompile.
Once again, when I open the workspace, the workspace settings start, so wait until it's done.
Then the error disappeared.
The language has changed from Japanese to English, but I have reset it again.

@findleyr
Copy link
Contributor

Closing as it doesn't appear there is anything going on here other than what is described in the error message. In order for gopls to work, you must open either a subdirectory of GOPATH/src, or a directory inside a module.

@stamblerre stamblerre removed this from the gopls/unplanned milestone Jun 21, 2021
@golang golang locked and limited conversation to collaborators Jun 21, 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. 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

6 participants