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

Go: Install/Update Tools: "gocode: Failed to close gocode process" #362

Closed
joe-getcouragenow opened this issue Jul 16, 2020 · 15 comments
Closed

Comments

@joe-getcouragenow
Copy link

joe-getcouragenow commented Jul 16, 2020

I have had this now twice in the last week. First time i figured well thats handover issues, but 2nd time is not....

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.4 darwin/amd64 
  • Run code -v or code-insiders -v to get version of VS Code or VS Code Insiders
code -v
1.47.1
485c41f9460bdb830c4da12c102daff275415b53
x64
  • Check your installed extensions to get the version of the VS Code Go extension
  • Run go env to get the go development environment details
GO111MODULE="on"
GOARCH="amd64"
GOBIN="/Users/apple/workspace/go/bin"
GOCACHE="/Users/apple/Library/Caches/go-build"
GOENV="/Users/apple/Library/Application Support/go/env"
GOEXE=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="darwin"
GOINSECURE=""
GONOPROXY=""
GONOSUMDB=""
GOOS="darwin"
GOPATH="/Users/apple/workspace/go"
GOPRIVATE=""
GOPROXY="https://proxy.golang.org,direct"
GOROOT="/usr/local/opt/go/libexec"
GOSUMDB="sum.golang.org"
GOTMPDIR=""
GOTOOLDIR="/usr/local/opt/go/libexec/pkg/tool/darwin_amd64"
GCCGO="gccgo"
AR="ar"
CC="clang"
CXX="clang++"
CGO_ENABLED="1"
GOMOD="/dev/null"
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"
PKG_CONFIG="pkg-config"
GOGCCFLAGS="-fPIC -m64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=/var/folders/wp/ff6sz9qs6g71jnm12nj2kbyw0000gp/T/go-build233778218=/tmp/go-build -gno-record-gcc-switches -fno-common"

Share the Go related settings you have added/edited

Run Preferences: Open Settings (JSON) command to open your settings.json file.
Share all the settings with the go. or ["go"] or gopls prefixes.

 //-------- Golang configuration --------
    // From: https://github.com/golang/tools/blob/master/gopls/doc/vscode.md
    "go.useLanguageServer": true,
    "[go]": {
        "editor.formatOnSave": true,
        "editor.codeActionsOnSave": {
            "source.organizeImports": true,
        },
        // Optional: Disable snippets, as they conflict with completion ranking.
        "editor.snippetSuggestions": "none",
    },
    "[go.mod]": {
        "editor.formatOnSave": true,
        "editor.codeActionsOnSave": {
            "source.organizeImports": true,
        },
    },
    "gopls": {
        // Add parameter placeholders when completing a function.
        "usePlaceholders": true,

        // If true, enable additional analyses with staticcheck.
        // Warning: This will significantly increase memory usage.
        "staticcheck": false,
    },

Describe the bug

WHen i run the golang tools install it ran but then failed:

Tools environment: GOPATH=/Users/apple/workspace/go, GOBIN=/Users/apple/workspace/go/bin
Installing 18 tools at the configured GOBIN: /Users/apple/workspace/go/bin in module mode.
  gocode
  gopkgs
  go-outline
  go-symbols
  guru
  gorename
  gotests
  gomodifytags
  impl
  fillstruct
  goplay
  godoctor
  dlv
  gocode-gomod
  godef
  goreturns
  golint
  gopls

Installing github.com/uudashr/gopkgs/v2/cmd/gopkgs SUCCEEDED
Installing github.com/ramya-rao-a/go-outline SUCCEEDED
Installing github.com/acroca/go-symbols SUCCEEDED
Installing golang.org/x/tools/cmd/guru SUCCEEDED
Installing golang.org/x/tools/cmd/gorename SUCCEEDED
Installing github.com/cweill/gotests/... SUCCEEDED
Installing github.com/fatih/gomodifytags SUCCEEDED
Installing github.com/josharian/impl SUCCEEDED
Installing github.com/davidrjenni/reftools/cmd/fillstruct SUCCEEDED
Installing github.com/haya14busa/goplay/cmd/goplay SUCCEEDED
Installing github.com/godoctor/godoctor SUCCEEDED
Installing github.com/go-delve/delve/cmd/dlv SUCCEEDED
Installing github.com/stamblerre/gocode SUCCEEDED
Installing github.com/rogpeppe/godef SUCCEEDED
Installing github.com/sqs/goreturns SUCCEEDED
Installing golang.org/x/lint/golint SUCCEEDED
Installing golang.org/x/tools/gopls SUCCEEDED

1 tools failed to install.

gocode: Failed to close gocode process: Error: Command failed: /Users/apple/workspace/go/bin/gocode close
2020/07/16 16:08:52 dial unix /var/folders/wp/ff6sz9qs6g71jnm12nj2kbyw0000gp/T/gocode-daemon.apple: connect: no such file or directory
. 

A clear and concise description of what you expected to happen.

For it to install all the tools ..

Steps to reproduce the behavior:

  1. Go to Command Pallet ... & Go: Install/Update Tools
  2. Click on all the check boxes
  3. See error above !

Screenshots or recordings

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

Screenshot 2020-07-16 at 16 28 30

@joe-getcouragenow joe-getcouragenow changed the title gocode: Failed to close gocode process: Error: Command failed: /Users/apple/workspace/go/bin/gocode close 2020/07/16 16:08:52 dial unix /var/folders/wp/ff6sz9qs6g71jnm12nj2kbyw0000gp/T/gocode-daemon.apple: connect: no such file or directory gocode: Failed to close gocode process: Error: Command failed: /Users/apple/workspace/go/bin/gocode close Jul 16, 2020
@joe-getcouragenow joe-getcouragenow changed the title gocode: Failed to close gocode process: Error: Command failed: /Users/apple/workspace/go/bin/gocode close During GO Tools install i get: "gocode: Failed to close gocode process" Jul 16, 2020
@joe-getcouragenow
Copy link
Author

joe-getcouragenow commented Jul 16, 2020

Investigating why this is happening.
Firstly It seems that gocode does NOT work with modules and is very old. Is there any point running this ?

It fails even if the binary is not installed:

stat /Users/apple/workspace/go/bin/gocode
stat: /Users/apple/workspace/go/bin/gocode: stat: No such file or directory

@joe-getcouragenow joe-getcouragenow changed the title During GO Tools install i get: "gocode: Failed to close gocode process" Go: Install/Update Tools: "gocode: Failed to close gocode process" Jul 16, 2020
@stamblerre
Copy link
Contributor

https://go-review.googlesource.com/c/vscode-go/+/242780 should have fixed this, but the fix has not yet been released. You can try the Nightly build of the extension to confirm if the fix works for you.

@stamblerre
Copy link
Contributor

Oh, actually, I believe that the Nightly build has not yet been released.
In the meantime, you can install gocode by running go get github.com/stamblerre/gocode. This version of gocode does work with modules, but if you want a better development experience with modules, we recommend gopls instead.

@hyangah
Copy link
Contributor

hyangah commented Jul 20, 2020

The new nightly version just published includes https://go-review.googlesource.com/c/vscode-go/+/242780
@joe-getcouragenow and anyone who experienced this issue can try and check if it's fixed?
I will make a point release with this cl once bug fix is confirmed.

@sanket-bhalerao
Copy link

for me, the tools do not install at all. it just stuck forever.
i tried to reinstall the extension (tried with the nightly and stable version as well)
restarting vscode does not help either.
with some luck, 1-2 tools got installed but not all.
I can not see any errors or any indication for error as well.

@hyangah
Copy link
Contributor

hyangah commented Jul 20, 2020

@sanket-bhalerao what is the nightly version?

@sanket-bhalerao
Copy link

@hyangah
image

@hyangah
Copy link
Contributor

hyangah commented Jul 20, 2020

@sanket-bhalerao Thanks. Can you manually install those tools? From a directory without go.mod file, run GO111MODULE=on go get -x <path to the tool you are trying to install>

@sanket-bhalerao
Copy link

I can manually install it

@hyangah
Copy link
Contributor

hyangah commented Jul 20, 2020

@sanket-bhalerao glad to hear that you could manually install it. What tool was the problematic one when trying to install with the extension?
We should add more logging definitely.

@sanket-bhalerao
Copy link

i could not get any of the 17 tools that are listed.

@gopherbot
Copy link
Collaborator

Change https://golang.org/cl/243700 mentions this issue: src/goTools.ts: apply timeout (1sec) in gocode close call

gopherbot pushed a commit that referenced this issue Jul 20, 2020
Also, report the tool version and the installation location
in the install success message, and include `-x` output in the
install failure message.

Update #362

Change-Id: Ie84a755fb1008bf048acec9c707b89a14cd960c0
Reviewed-on: https://go-review.googlesource.com/c/vscode-go/+/243700
Reviewed-by: Rebecca Stambler <[email protected]>
@joe-getcouragenow
Copy link
Author

@hyangah @stamblerre

OK so it works fully for me just now.

VSCODE prompted to restart due to a new version of itself, detected that i had upgraded golang to 1.14.5, and prompted me to reinstall all the golang tools. Perfect workflow !!



go version go1.14.5 darwin/amd64

Tools environment: GOPATH=/Users/apple/workspace/go, GOBIN=/Users/apple/workspace/go/bin
Installing 17 tools at the configured GOBIN: /Users/apple/workspace/go/bin in module mode.
  gopkgs
  go-outline
  go-symbols
  guru
  gorename
  gotests
  gomodifytags
  impl
  fillstruct
  goplay
  godoctor
  dlv
  gocode-gomod
  godef
  goreturns
  golint
  gopls

Installing github.com/uudashr/gopkgs/v2/cmd/gopkgs SUCCEEDED
Installing github.com/ramya-rao-a/go-outline SUCCEEDED
Installing github.com/acroca/go-symbols SUCCEEDED
Installing golang.org/x/tools/cmd/guru SUCCEEDED
Installing golang.org/x/tools/cmd/gorename SUCCEEDED
Installing github.com/cweill/gotests/... SUCCEEDED
Installing github.com/fatih/gomodifytags SUCCEEDED
Installing github.com/josharian/impl SUCCEEDED
Installing github.com/davidrjenni/reftools/cmd/fillstruct SUCCEEDED
Installing github.com/haya14busa/goplay/cmd/goplay SUCCEEDED
Installing github.com/godoctor/godoctor SUCCEEDED
Installing github.com/go-delve/delve/cmd/dlv SUCCEEDED
Installing github.com/stamblerre/gocode SUCCEEDED
Installing github.com/rogpeppe/godef SUCCEEDED
Installing github.com/sqs/goreturns SUCCEEDED
Installing golang.org/x/lint/golint SUCCEEDED
Installing golang.org/x/tools/gopls SUCCEEDED

All tools successfully installed. You are ready to Go :).

I think i can close this now ?

@gopherbot
Copy link
Collaborator

Change https://golang.org/cl/243898 mentions this issue: [release] goTools: don't fail gocode installation if gocode is not already running

gopherbot pushed a commit that referenced this issue Jul 21, 2020
…ready running

Fixes #355
Fixes #362

Change-Id: Ifdf229ce52a6a4b1a2e4f0a28ac5596405ff4c56
Reviewed-on: https://go-review.googlesource.com/c/vscode-go/+/242780
Reviewed-by: Hyang-Ah Hana Kim <[email protected]>
(cherry picked from commit db1d1b3)
Reviewed-on: https://go-review.googlesource.com/c/vscode-go/+/243898
Reviewed-by: Rebecca Stambler <[email protected]>
@hyangah
Copy link
Contributor

hyangah commented Jul 22, 2020

0.15.2 is released including the cl https://go-review.googlesource.com/c/vscode-go/+/242780
CL https://golang.org/cl/243898 didn't make to 0.15.2, but is in the latest nightly. It will be in 0.16.0.

I am not sure the cause of the problem @sanket-bhalerao is experiencing. (maybe try gocode close manually and see if it hangs). If you keep getting installation failures, please file a new issue.

Thanks!

@hyangah hyangah closed this as completed Jul 22, 2020
@golang golang locked and limited conversation to collaborators Jul 22, 2021
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

5 participants