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: clarify error messages, make error messages more visible to the user #31668

Open
ianthehat opened this issue Apr 25, 2019 · 2 comments
Assignees
Milestone

Comments

@ianthehat
Copy link

@ianthehat ianthehat commented Apr 25, 2019

There are a few ways we have problems working on a file, and we need to report them to the user in a way that lets them understand and fix the problem
Some causes are:

  • The opened folder is not inside a valid workspace (module, GOPATH, other)
  • The file is excluded by build tags
  • The file is in an excluded folder (or other build system specific rules)
  • The file is a pure overlay for a package we do not recognize

Each of these may require a different mechanism for detection, a different heuristic to suggest the root cause or fix, and maybe a different way to report the error.

@odeke-em odeke-em changed the title gopls: it is confusing when a go file is not being handled x/tools/cmd/gopls: it is confusing when a go file is not being handled Apr 25, 2019
@gopherbot gopherbot added this to the Unreleased milestone Apr 25, 2019
@stamblerre stamblerre changed the title x/tools/cmd/gopls: it is confusing when a go file is not being handled x/tools/cmd/gopls: clarify error messages, make error messages more visible to the user Jun 5, 2019
@marco-m

This comment has been minimized.

Copy link

@marco-m marco-m commented Jun 12, 2019

Thanks for this ticket Go team! 🙏

@stamblerre stamblerre changed the title x/tools/cmd/gopls: clarify error messages, make error messages more visible to the user x/tools/gopls: clarify error messages, make error messages more visible to the user Jul 2, 2019
@gopherbot gopherbot added the Tools label Sep 12, 2019
@gopherbot

This comment has been minimized.

Copy link

@gopherbot gopherbot commented Sep 13, 2019

Change https://golang.org/cl/194018 mentions this issue: internal/lsp: show errors when the user is in the wrong directory

gopherbot pushed a commit to golang/tools that referenced this issue Sep 17, 2019
If we encounter `go list` errors when loading a user's package, we
should try to see if they've encountered any of our common error cases.
They are: 1) a user has GO111MODULE=off, but is outside of their GOPATH,
and 2) a user is in module mode but doesn't have a go.mod file.

Fortunately, go/packages does a great job handling edge cases so gopls
will work well for most of them. The main issue will be unresolved
imports. These show up in DepErrors in `go list`, so go/packages doesn't
propagate them through to the list of errors. This will require changes
to go/packages.

Updates golang/go#31668

Change-Id: Ibd5253b33b38caffeaad54a403c74c0b861fcc14
Reviewed-on: https://go-review.googlesource.com/c/tools/+/194018
Run-TryBot: Rebecca Stambler <rstambler@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Cottrell <iancottrell@google.com>
clintjedwards added a commit to clintjedwards/tools that referenced this issue Sep 19, 2019
If we encounter `go list` errors when loading a user's package, we
should try to see if they've encountered any of our common error cases.
They are: 1) a user has GO111MODULE=off, but is outside of their GOPATH,
and 2) a user is in module mode but doesn't have a go.mod file.

Fortunately, go/packages does a great job handling edge cases so gopls
will work well for most of them. The main issue will be unresolved
imports. These show up in DepErrors in `go list`, so go/packages doesn't
propagate them through to the list of errors. This will require changes
to go/packages.

Updates golang/go#31668

Change-Id: Ibd5253b33b38caffeaad54a403c74c0b861fcc14
Reviewed-on: https://go-review.googlesource.com/c/tools/+/194018
Run-TryBot: Rebecca Stambler <rstambler@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Cottrell <iancottrell@google.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
4 participants
You can’t perform that action at this time.