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/cmd/gopls: support for module mode without go.mod #31837
Comments
This is not going to be changed, sorry, server mode is not supported at all, it is a pure debugging aid, but when it does work we will only support the command line adding a new view to the server based on its current working directory, which means where you launch the server from will not matter, but where you launch the client from still will. |
I understand that gopls needs to have an explicit working directory, and I'm not proposing to remove that expectation. In the case when a package has no relative imports and neither has an explicit go.mod nor is in GOPATH, allowing editors to rely on gopls to provide users' the experience they expect (especially given that Sorry, I didn't mean literally the server mode of gopls that's used for debugging; I just meant the usual mode used by editors as opposed to No worries if the answer is still never, but I wanted to make sure I laid out the use case better. |
I didn't have any idea that @bhcleek Thanks for pointing that out! |
|
Yea, I'm aware of that, but I wanted to edit files in a directory that is not in |
|
Sure, I'm not saying you have to. It would just be helpful if that's written in the docs. |
@stamblerre what is it about
|
What version of Go are you using (
go version
)?go version go1.12.4 darwin/amd64
Does this issue reproduce with the latest release?
Yes
What operating system and processor architecture are you using (
go env
)?go env
OutputWhat did you do?
Attempted to use
gopls
in a directory that is not in$GOPATH
and is without ago.mod
file.A file to test with:
And a simple test case:
What did you expect to see?
Generally, I expected it to work, because the release notes for Go 1.12 state explicitly in https://golang.org/doc/go1.12#modules:
Using the simple test case provided above, I would expect the output to be
What did you see instead?
When run as a server,
gopls
claims that that there's no information known about the file.The simple test case provided above outputs:
The text was updated successfully, but these errors were encountered: