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

x/tools/gopls: don't warn about misconfiguration in std and cmd modules #37906

FiloSottile opened this issue Mar 17, 2020 · 5 comments
Labels
Milestone

Comments

@FiloSottile
Copy link
Member

@FiloSottile FiloSottile commented Mar 17, 2020

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
@stamblerre stamblerre modified the milestones: Unreleased, gopls/v0.4.0 Mar 18, 2020
@stamblerre
Copy link
Contributor

@stamblerre stamblerre commented Mar 18, 2020

What directory are you opening in your editor?

@FiloSottile
Copy link
Member Author

@FiloSottile FiloSottile commented Mar 18, 2020

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 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
Member

@bcmills 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

@stamblerre stamblerre commented Mar 18, 2020

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.

@stamblerre stamblerre closed this Mar 18, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
5 participants
You can’t perform that action at this time.