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: don't warn about misconfiguration in std and cmd modules #37906

Closed
FiloSottile opened this issue Mar 17, 2020 · 5 comments
Closed
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.
Milestone

Comments

@FiloSottile
Copy link
Contributor

I am using the latest gopls while developing the standard library (specifically crypto/x509) at tip, and everything seems to work, but the following warning keeps popping up, presumably because the std module is weird, but still works with go/packages.

You are neither in a module nor in your GOPATH. Please see https://github.com/golang/go/wiki/Modules for information on how to set up your Go project.

$ go version
go version devel +971f8a2f9a Tue Mar 17 23:02:30 2020 +0000 darwin/amd64
@gopherbot gopherbot added this to the Unreleased milestone Mar 17, 2020
@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 Mar 17, 2020
@stamblerre stamblerre modified the milestones: Unreleased, gopls/v0.4.0 Mar 18, 2020
@stamblerre
Copy link
Contributor

stamblerre commented Mar 18, 2020

What directory are you opening in your editor?

@FiloSottile
Copy link
Contributor Author

I am opening the GOROOT. Should I be opening GOROOT/std?

That does make sense, but it's pretty inconvenient for standard library development, because the outer directories have non-go files that are useful to look at the same time.

@zikaeroh
Copy link
Contributor

zikaeroh commented Mar 18, 2020

I recently submitted a few CLs and used gopls for it; to make things (kinda) work with the local clone, I had to both open $GOROOT/src, and ensure that $GOROOT/bin was in my PATH when I launched my editor (otherwise things mismatched).

@bcmills
Copy link
Contributor

bcmills commented Mar 18, 2020

GOROOT is not in the std module, but it should be ok to build and test things in std and cmd without being in those modules (as long as you don't need to update their vendored dependencies).

@stamblerre
Copy link
Contributor

This is a current limitation of gopls - we're aiming to fix this in gopls/v0.5.0. You should only see this error message if you open $GOROOT and add an unresolved import, but in the meantime, the recommended work-around is to add the folder to your workspace (File -> Add folder to workspace). I'll close this issue now, but we'll hopefully have it resolved by gopls/v0.5.0.

@golang golang locked and limited conversation to collaborators Mar 18, 2021
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.
Projects
None yet
Development

No branches or pull requests

5 participants