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

expected declaration, found ... #3191

Closed
butuzov opened this issue Apr 19, 2020 · 8 comments
Closed

expected declaration, found ... #3191

butuzov opened this issue Apr 19, 2020 · 8 comments
Labels
upstream-gopls Issue for gopls

Comments

@butuzov
Copy link

butuzov commented Apr 19, 2020

Please answer these questions before submitting your issue. Thanks!

gopls log, main.go and settings.json can be found in https://gist.github.com/butuzov/9c658702ccb8944a9b2fdddd0d1bdc77

What version of Go, VS Code & VS Code Go extension are you using?

  • Run go version to get version of Go
    • go version go1.14.2 darwin/amd64
  • Run code -v or code-insiders -v to get version of VS Code or VS Code Insiders
    • 1.44.2
    • ff915844119ce9485abfe8aa9076ec76b5300ddd
    • x64
  • Check your installed extensions to get the version of the VS Code Go extension
    • 0.14.1
  • Run go env GOOS GOARCH to get the operating system and processor architecture details
    - darwin
    - amd64

Share the Go related settings you have added/edited

See settings.json in gist (settings edited out, and left only ones related to GO)

Describe the bug

  • Trying to save file, so I can get
import "fmt"

inserted by format tool, but i can't. it's just doesn't work.

Screenshots or recordings

If applicable, add screenshots or recordings to help explain your problem.
image


Once restarted, problem gone.

@stamblerre stamblerre added the upstream-gopls Issue for gopls label Apr 19, 2020
@stamblerre
Copy link
Contributor

Thank you for the report and the logs. Unfortunately it's a bit difficult to understand what went wrong because the logs are not verbose. In the future, you can add the settings listed here to get more detailed logs.

A few questions: Does this happen to you frequently or was it just this one time? Is there any way to reproduce the issue? Was this a newly-created file or an existing one?

@butuzov
Copy link
Author

butuzov commented Apr 19, 2020

Does this happen to you frequently or was it just this one time?

Yes, in the last week or two, quite often.

  1. If code has an error, I can't even save it because of "Saving... dialog"
  2. If error expected to be removed with goimports (like a missing package in example above), but no formatonsave is running...

Is there any way to reproduce the issue?

it's happens randomly.

Was this a newly-created file or an existing one?

It was existing file.


I have disable all settings at the moment at except, lets see if i can trigger same behaviour with almost default settings

"go.useLanguageServer": true,
"go.languageServerFlags": [
        "-rpc.trace",  
        "serve",
        "--debug=localhost:6060",   
],

@butuzov
Copy link
Author

butuzov commented Apr 19, 2020

New case. Once i disabled Go extension, everything stopped.
https://gist.github.com/butuzov/eae0285bc04b61b245e985a896425958

Despite having 12 cores, my computer barely worked. I am not aware of what is triggering spawning "pgrep" processes.

@stamblerre
Copy link
Contributor

Despite having 12 cores, my computer barely worked. I am not aware of what is triggering spawning "pgrep" processes.

That sounds like #3189 and #3178.

Thanks for sharing the gopls logs. Nothing jumps out at me as being problematic - what went wrong when you generated this log? I filed #3179 to track these on-save issues, and a number of users have reported that disabling another extension fixes the issue for them. What other extensions do you have installed?

@butuzov
Copy link
Author

butuzov commented Apr 20, 2020

ok. so... i was able to replicate the issue.

  1. I had reinstall vsc

  2. All extensions disabled (except go)

  3. Empty (common) main.go

  4. Running snippet (ff)

    package main
    
    func main() {
    	fmt.Printf("", var)
    }
  5. Saving it without filling placeholders (file with errors)

  6. Hitting cmd+s few times.

We have spikes in pgrep

Repeating this procedure few times. Yep, it's triggering "Save..." dialog issue, and spawning a few thousand pgrep procs across my system.

I switched the lint tool to simple golint, and everything seems back to normal. However, Rebecca, what do you think is happening (i am not familiar with vscode, vscode-go or even gopls internals)? Is it golangci-lint issue or it's some kind of ddos scenario (it least it looks like this).

@stamblerre
Copy link
Contributor

The pgrep issue was caused by the release of 0.14. A temporary workaround would be to downgrade back to the 0.13 version of the extension. It's hard to figure out what's going on with gopls versus this issue since this issue isn't caused by gopls.

@onlyafly
Copy link

The pgrep issue was caused by the release of 0.14. A temporary workaround would be to downgrade back to the 0.13 version of the extension. It's hard to figure out what's going on with gopls versus this issue since this issue isn't caused by gopls.

Thanks, @stamblerre! This saved me from temporarily switching to a different editor!

@stamblerre
Copy link
Contributor

Duplicate of #3178

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
upstream-gopls Issue for gopls
Projects
None yet
Development

No branches or pull requests

3 participants