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: show error messages about "orphaned" files to the user #31668

Open
ianthehat opened this issue Apr 25, 2019 · 3 comments
Open

x/tools/gopls: show error messages about "orphaned" files to the user #31668

ianthehat opened this issue Apr 25, 2019 · 3 comments
Assignees
Labels
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
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
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>
@stamblerre stamblerre modified the milestones: Unreleased, gopls v1.0 Dec 4, 2019
@stamblerre stamblerre modified the milestones: gopls/v1.0.0, gopls/v0.5.0 Jun 24, 2020
@stamblerre
Copy link
Contributor

@stamblerre stamblerre commented Jun 24, 2020

I believe that the main remaining case to address here is files excluded by build tags. We should probably show a pop-up saying that we can't map them to any package. (Maybe we should do that for all files we can't place in a package?)

@stamblerre stamblerre changed the title x/tools/gopls: clarify error messages, make error messages more visible to the user x/tools/gopls: show error messages about "orphaned" files to the user Jun 24, 2020
@stamblerre stamblerre modified the milestones: gopls/v0.5.0, gopls/v1.0.0 Jul 22, 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
4 participants
You can’t perform that action at this time.