Skip to content
This repository has been archived by the owner on Jul 15, 2023. It is now read-only.

When gopkgs fails to get packages, there is no user notification #1471

Closed
ramya-rao-a opened this issue Jan 18, 2018 · 5 comments
Closed

When gopkgs fails to get packages, there is no user notification #1471

ramya-rao-a opened this issue Jan 18, 2018 · 5 comments

Comments

@ramya-rao-a
Copy link
Contributor

gopkgs is used to get packages that are used bu the auto-completion feature to provide the completions for unimported packages. When gopkgs fails, we log a message to the console (See https://github.com/Microsoft/vscode-go/blob/0.6.72/src/goPackages.ts#L103).

This is not enough, there should be a user notification about the same.

gopkgs gets called for every auto-completion request, but this error should not be notified for every request. Once for a VS Code session will do.

PRs are welcome

@mkorejo
Copy link
Contributor

mkorejo commented Jan 31, 2018

Hi @ramya-rao-a,

I made some changes for this issue but before a PR, I am trying to test/debug locally. Can you suggest a way to get gopkgs to fail such that the console message is generated? I can't seem to get that part of the code to run, or get that message to show in the Developer Tools Console.

I tried renaming the gopkgs binary on my machine so VS Code couldn't find it. I got this message to appear:
image

Then tried ^Space, and actually it looks like I'm still able to get import suggestions somehow, but no console message:
image
image
image

Also played with GOPATH a bit but really just not sure how to simulate this issue.

Thanks very much for your work on this plugin!

@ramya-rao-a
Copy link
Contributor Author

@mkorejo One simple way to make gopkgs fail would be to change gopkgs itself :) You can find the code for it in GOPATH/src/github.com/uudashr/gopkgs/cmd/gopkgs, make a change and run go install to make sure the binary updates. @uudashr might have better ideas though :)

@uudashr
Copy link
Contributor

uudashr commented Feb 15, 2018

@mkorejo @ramya-rao-a

Not sure how to make it fail. The empty result will happen only when there is no packages on the GOPATH or GOROOT, which kind a weird. This is more like a panic mode, things that impossible. It is possible but the go extension will also fail.

But if really want to make it fail

  1. just modify the GOPATH/src/github.com/uudashr/gopkgs/cmd/gopkgs to return empty
  2. or do it here https://github.com/Microsoft/vscode-go/blob/0.6.72/src/goPackages.ts#L16 to return empty

@ramya-rao-a
Copy link
Contributor Author

Or maybe modify gopkgs to return empty array?

mkorejo added a commit to mkorejo/vscode-go that referenced this issue Feb 20, 2018
@mkorejo
Copy link
Contributor

mkorejo commented Feb 20, 2018

Two commits more than it should've taken but I think I got it. Thanks for the tips @ramya-rao-a and @uudashr! Hacking gopkgs was a simple and fun exercise. See PR #1528.

@vscodebot vscodebot bot locked and limited conversation to collaborators Apr 6, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants