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: failures when switching from GOPATH to modules #37069

Closed
stamblerre opened this issue Feb 5, 2020 · 3 comments
Closed

x/tools/gopls: failures when switching from GOPATH to modules #37069

stamblerre opened this issue Feb 5, 2020 · 3 comments
Labels
FrozenDueToAge gopls Issues related to the Go language server, gopls. NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. Tools This label describes issues relating to any tools in the x/tools repository.
Milestone

Comments

@stamblerre
Copy link
Contributor

Reported by @tbpg (please correct me if I'm mistaken here).

Repro steps:

  1. Open a package that was previously set up to work in GOPATH mode.
  2. Initialize a module.
  3. There is a missing dependency - add it to the go.mod.
  4. Errors about the missing dependency do not go away.
@gopherbot gopherbot added this to the Unreleased milestone Feb 5, 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 Feb 5, 2020
@stamblerre stamblerre modified the milestones: Unreleased, gopls/v0.4.0 Feb 5, 2020
@tbpg
Copy link
Contributor

tbpg commented Feb 6, 2020

The missing dependency was a package within the project.

Kind of like this:

.
├── bar
│   └── bar.go
└── foo.go # imported myproject/bar

When I opened foo.go, there was an error about not being able to find myproject/bar. So, I did go mod init example.com/myproject then changed the import to example.com/myproject/bar.

Then I still got the error that myproject/bar was not found (not an error about example.com/myproject/bar)

@stamblerre stamblerre added the NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. label Feb 26, 2020
@stamblerre stamblerre modified the milestones: gopls/v0.4.0, gopls/v0.5.0 Apr 2, 2020
@stamblerre stamblerre modified the milestones: gopls/v0.5.0, gopls/v1.0.0 Jul 22, 2020
@stamblerre
Copy link
Contributor Author

I am not able to reproduce this when running through the repro steps myself in gopls, but I am able to reproduce this in a regression test, which leads me to believe that this is an issue caused by #40340. Going to close this as a duplicate, but put up a CL with this repro case as a regression test.

@gopherbot
Copy link
Contributor

Change https://golang.org/cl/245818 mentions this issue: internal/lsp: add a test for golang/go#37069

gopherbot pushed a commit to golang/tools that referenced this issue Sep 1, 2020

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
Also, add a directory parameter to RunGoCommand. To make sure that the
parameters aren't misused, change args to a []string.

Updates golang/go#40340

Change-Id: Ib5ce606a401a18c29c904b570ec9339f067a3961
Reviewed-on: https://go-review.googlesource.com/c/tools/+/245818
Run-TryBot: Rebecca Stambler <rstambler@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Robert Findley <rfindley@google.com>
leitzler added a commit to govim/govim that referenced this issue Sep 2, 2020
* internal/lsp: run gopls as long as there is one folder with a file URI d1954cc8
* internal/lsp/regtest: reproduce edge cases when creating new files c3046009
* internal/span: remove check for nil content bf6e7d25
* internal/lsp: add package completion suggestions cf97e2b3
* internal/lsp/lsprpc: make the LSP forwarder exit error clearer 80e1b039
* internal/lsp: use -json for module upgrades 6fbec87e
* unusedresult.go: Include context.With* functions 6e59e247
* internal/lsp: add a test that reproduces golang/go#37069 fd8950f6
* all: update dependencies in tools and gopls modules 5a2aa26b
* internal/lsp/cache: don't invalidate metadata for new invalid imports 5deb2631
* internal/lsp/fuzzy: fix return value on no match 6c983e67
* internal/lsp/source: remove dead code from completion 97019fc2
* internal/lsp/source: add some downranking for workspace symbols 3c805d23
* internal/lsp: refactor workspace Symbol method 88346e99
* internal/lsp: add completion suggestions for import statements 84ab5701
* internal/lsp/regtest: add benchmarks for IWL and completion 06cc1d0a
* lsp/general.go: change error messages to give more context 021d7c6f
* internal/lsp, go/packages: work-around invalid files in GOPATH mode debfaf60
* godoc: fix panic in Presentation.ServeFile 97606e32
* internal/lsp/source: do not allow extraction of an import spec 989ebae2
* internal/lsp: fix builds and tests for go1.12+ df83f4e7
* internal/lsp/regtest: add a workspace symbols benchmark 17fd2f27
* internal/lsp/source: sort references and implementations results b85e56c1
* internal/lsp: ignore period ('.') triggered completions in comments bc8aaaa2
* internal/lsp/source: use space character in markdown formatting f57a28cb
* internal/lsp/mod: handle nil pointer exception for empty go.mod files 28d6951f
* internal/lsp/source: fix completion on final line of a document e0bf2294
* internal/lsp: use prefix matcher with comment completion b72e8bb6
* internal/analysisinternal: add anonymous structs & interfaces to b303f430
* internal/lsp: don't panic if there are no suggested fixes c024452a
* internal/lsp: do not log failed suggested fix for fillstruct to stderr 307de81b
* internal/lsp: improvements for command messages 1e23e48a
* internal/lsp/regtest: reproduce empty xtest bug 3366bbee
* internal/lsp: add ast fields to comment completion for declarations 3509cdc6
* internal/lsp/source: fix panic in formatZeroValue for invalid type daa65388
* internal/lsp/source: fix composite literal type name completion 74543c40
* internal/lsp/lsprpc: quiet the handshaker during regtests c886c0b6
* internal/lsp: consolidate progress reporting ed71c572
* internal/lsp/source: improve completion of printf operands 9ac8e33b
leitzler added a commit to govim/govim that referenced this issue Sep 2, 2020
Note that this change also shorten the default errlogmatch wait time
from 30s to 25s to slightly improve CI test time and avoid hitting the
10 minute limit.

* internal/lsp: run gopls as long as there is one folder with a file URI d1954cc8
* internal/lsp/regtest: reproduce edge cases when creating new files c3046009
* internal/span: remove check for nil content bf6e7d25
* internal/lsp: add package completion suggestions cf97e2b3
* internal/lsp/lsprpc: make the LSP forwarder exit error clearer 80e1b039
* internal/lsp: use -json for module upgrades 6fbec87e
* unusedresult.go: Include context.With* functions 6e59e247
* internal/lsp: add a test that reproduces golang/go#37069 fd8950f6
* all: update dependencies in tools and gopls modules 5a2aa26b
* internal/lsp/cache: don't invalidate metadata for new invalid imports 5deb2631
* internal/lsp/fuzzy: fix return value on no match 6c983e67
* internal/lsp/source: remove dead code from completion 97019fc2
* internal/lsp/source: add some downranking for workspace symbols 3c805d23
* internal/lsp: refactor workspace Symbol method 88346e99
* internal/lsp: add completion suggestions for import statements 84ab5701
* internal/lsp/regtest: add benchmarks for IWL and completion 06cc1d0a
* lsp/general.go: change error messages to give more context 021d7c6f
* internal/lsp, go/packages: work-around invalid files in GOPATH mode debfaf60
* godoc: fix panic in Presentation.ServeFile 97606e32
* internal/lsp/source: do not allow extraction of an import spec 989ebae2
* internal/lsp: fix builds and tests for go1.12+ df83f4e7
* internal/lsp/regtest: add a workspace symbols benchmark 17fd2f27
* internal/lsp/source: sort references and implementations results b85e56c1
* internal/lsp: ignore period ('.') triggered completions in comments bc8aaaa2
* internal/lsp/source: use space character in markdown formatting f57a28cb
* internal/lsp/mod: handle nil pointer exception for empty go.mod files 28d6951f
* internal/lsp/source: fix completion on final line of a document e0bf2294
* internal/lsp: use prefix matcher with comment completion b72e8bb6
* internal/analysisinternal: add anonymous structs & interfaces to b303f430
* internal/lsp: don't panic if there are no suggested fixes c024452a
* internal/lsp: do not log failed suggested fix for fillstruct to stderr 307de81b
* internal/lsp: improvements for command messages 1e23e48a
* internal/lsp/regtest: reproduce empty xtest bug 3366bbee
* internal/lsp: add ast fields to comment completion for declarations 3509cdc6
* internal/lsp/source: fix panic in formatZeroValue for invalid type daa65388
* internal/lsp/source: fix composite literal type name completion 74543c40
* internal/lsp/lsprpc: quiet the handshaker during regtests c886c0b6
* internal/lsp: consolidate progress reporting ed71c572
* internal/lsp/source: improve completion of printf operands 9ac8e33b
leitzler added a commit to govim/govim that referenced this issue Sep 2, 2020
Note that this change also shorten the errlogmatch wait time when
running docker based tests in GitHub actions, to slightly improve
CI test time and avoid hitting the 10 minute limit.

* internal/lsp: run gopls as long as there is one folder with a file URI d1954cc8
* internal/lsp/regtest: reproduce edge cases when creating new files c3046009
* internal/span: remove check for nil content bf6e7d25
* internal/lsp: add package completion suggestions cf97e2b3
* internal/lsp/lsprpc: make the LSP forwarder exit error clearer 80e1b039
* internal/lsp: use -json for module upgrades 6fbec87e
* unusedresult.go: Include context.With* functions 6e59e247
* internal/lsp: add a test that reproduces golang/go#37069 fd8950f6
* all: update dependencies in tools and gopls modules 5a2aa26b
* internal/lsp/cache: don't invalidate metadata for new invalid imports 5deb2631
* internal/lsp/fuzzy: fix return value on no match 6c983e67
* internal/lsp/source: remove dead code from completion 97019fc2
* internal/lsp/source: add some downranking for workspace symbols 3c805d23
* internal/lsp: refactor workspace Symbol method 88346e99
* internal/lsp: add completion suggestions for import statements 84ab5701
* internal/lsp/regtest: add benchmarks for IWL and completion 06cc1d0a
* lsp/general.go: change error messages to give more context 021d7c6f
* internal/lsp, go/packages: work-around invalid files in GOPATH mode debfaf60
* godoc: fix panic in Presentation.ServeFile 97606e32
* internal/lsp/source: do not allow extraction of an import spec 989ebae2
* internal/lsp: fix builds and tests for go1.12+ df83f4e7
* internal/lsp/regtest: add a workspace symbols benchmark 17fd2f27
* internal/lsp/source: sort references and implementations results b85e56c1
* internal/lsp: ignore period ('.') triggered completions in comments bc8aaaa2
* internal/lsp/source: use space character in markdown formatting f57a28cb
* internal/lsp/mod: handle nil pointer exception for empty go.mod files 28d6951f
* internal/lsp/source: fix completion on final line of a document e0bf2294
* internal/lsp: use prefix matcher with comment completion b72e8bb6
* internal/analysisinternal: add anonymous structs & interfaces to b303f430
* internal/lsp: don't panic if there are no suggested fixes c024452a
* internal/lsp: do not log failed suggested fix for fillstruct to stderr 307de81b
* internal/lsp: improvements for command messages 1e23e48a
* internal/lsp/regtest: reproduce empty xtest bug 3366bbee
* internal/lsp: add ast fields to comment completion for declarations 3509cdc6
* internal/lsp/source: fix panic in formatZeroValue for invalid type daa65388
* internal/lsp/source: fix composite literal type name completion 74543c40
* internal/lsp/lsprpc: quiet the handshaker during regtests c886c0b6
* internal/lsp: consolidate progress reporting ed71c572
* internal/lsp/source: improve completion of printf operands 9ac8e33b
leitzler added a commit to govim/govim that referenced this issue Sep 2, 2020
Note that this change also shorten the errlogmatch wait time when
running docker based tests in GitHub actions, to slightly improve
CI test time and avoid hitting the 10 minute limit.

* internal/lsp: run gopls as long as there is one folder with a file URI d1954cc8
* internal/lsp/regtest: reproduce edge cases when creating new files c3046009
* internal/span: remove check for nil content bf6e7d25
* internal/lsp: add package completion suggestions cf97e2b3
* internal/lsp/lsprpc: make the LSP forwarder exit error clearer 80e1b039
* internal/lsp: use -json for module upgrades 6fbec87e
* unusedresult.go: Include context.With* functions 6e59e247
* internal/lsp: add a test that reproduces golang/go#37069 fd8950f6
* all: update dependencies in tools and gopls modules 5a2aa26b
* internal/lsp/cache: don't invalidate metadata for new invalid imports 5deb2631
* internal/lsp/fuzzy: fix return value on no match 6c983e67
* internal/lsp/source: remove dead code from completion 97019fc2
* internal/lsp/source: add some downranking for workspace symbols 3c805d23
* internal/lsp: refactor workspace Symbol method 88346e99
* internal/lsp: add completion suggestions for import statements 84ab5701
* internal/lsp/regtest: add benchmarks for IWL and completion 06cc1d0a
* lsp/general.go: change error messages to give more context 021d7c6f
* internal/lsp, go/packages: work-around invalid files in GOPATH mode debfaf60
* godoc: fix panic in Presentation.ServeFile 97606e32
* internal/lsp/source: do not allow extraction of an import spec 989ebae2
* internal/lsp: fix builds and tests for go1.12+ df83f4e7
* internal/lsp/regtest: add a workspace symbols benchmark 17fd2f27
* internal/lsp/source: sort references and implementations results b85e56c1
* internal/lsp: ignore period ('.') triggered completions in comments bc8aaaa2
* internal/lsp/source: use space character in markdown formatting f57a28cb
* internal/lsp/mod: handle nil pointer exception for empty go.mod files 28d6951f
* internal/lsp/source: fix completion on final line of a document e0bf2294
* internal/lsp: use prefix matcher with comment completion b72e8bb6
* internal/analysisinternal: add anonymous structs & interfaces to b303f430
* internal/lsp: don't panic if there are no suggested fixes c024452a
* internal/lsp: do not log failed suggested fix for fillstruct to stderr 307de81b
* internal/lsp: improvements for command messages 1e23e48a
* internal/lsp/regtest: reproduce empty xtest bug 3366bbee
* internal/lsp: add ast fields to comment completion for declarations 3509cdc6
* internal/lsp/source: fix panic in formatZeroValue for invalid type daa65388
* internal/lsp/source: fix composite literal type name completion 74543c40
* internal/lsp/lsprpc: quiet the handshaker during regtests c886c0b6
* internal/lsp: consolidate progress reporting ed71c572
* internal/lsp/source: improve completion of printf operands 9ac8e33b
@golang golang locked and limited conversation to collaborators Jul 31, 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. NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. Tools This label describes issues relating to any tools in the x/tools repository.
Projects
None yet
Development

No branches or pull requests

3 participants