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

After upgrade GO to 1.7 version, the Code just won't show intellisense for a variable #441

Closed
alexdima opened this issue Aug 18, 2016 · 42 comments

Comments

@alexdima
Copy link
Member

Moved from microsoft/vscode#10639


From @Dmdv

  • VSCode Version: Code 1.4.0 (6276dcb0ae497766056b4c09ea75be1d76a8b679, 2016-08-04T16:45:31.680Z)
  • OS Version: Windows_NT ia32 10.0.10586

Steps to Reproduce:

  1. choose GOLANG environment
  2. start coding, declare import, for example fmt
  3. after typing fmt. and pressing space there is no dropdown hint about available methods, just "Panic"
@sunnyawake5
Copy link

same issue here. fmt. doesn't work, fmt.Println( works.

@wanderingeek
Copy link

wanderingeek commented Aug 18, 2016

Same here.

screen shot 2016-08-18 at 5 47 27 pm

Environment:-
Mac OS X 10.11.6
VS Code 1.4.0[ 6276dcb0ae497766056b4c09ea75be1d76a8b679, 2016-08-04T16:39:36.387Z ]
go version go1.7 darwin/amd64

@lukehoban
Copy link
Contributor

This looks like the same issue as #436 and #425. Running gocode close should fix this.

@wanderingeek
Copy link

wanderingeek commented Aug 18, 2016

gocode close and go get -u github.com/nsf/gocode fixed it for me.

Thanks @lukehoban

@asaf
Copy link

asaf commented Aug 18, 2016

On MacOS, I had a gocode daemon running, I killed it / gocode close, re-opened studio and everything worked.

@tracer0tong
Copy link

Recipe works that's nice, but is it possible to include this gocode restart and update as part of new vscode-go? Or may be in documentation? At least this should be part of Release notes.

@Dmdv
Copy link

Dmdv commented Aug 19, 2016

Recipe worked. Thank you

@lukehoban
Copy link
Contributor

@tracer0tong I've updated the README with a note. Unfortunately, I'm not sure it's safe/wise for the extension to restart the gocode daemon everything it launches, as that would have performance implications and potentially interact poorly with other tools that use gocode.

@hinst
Copy link

hinst commented Aug 22, 2016

I get PANIC PANIC. I removed all tools, then installed all tools but it did not help

@lukehoban
Copy link
Contributor

@hinst did you run gocode close

@utrescu
Copy link

utrescu commented Aug 27, 2016

Fedora: Only gocode close does not work.

I need to do gocode close and go get -u github.com/nsf/gocode to get it working again.

@theGeekPirate
Copy link

gocode close and go get -u github.com/nsf/gocode wasn't enough on Arch Linux, I also had to terminate the process manually.

@hilljgo
Copy link

hilljgo commented Sep 14, 2016

gocode will hog up my CPU every ten minutes or so, making my laptop sound like an airplane is about to take off. Having to run gocode close every ten minutes is quite annoying

@theGeekPirate
Copy link

@hilljgo Please search all previous issues to see if one is similar to your own problem (creating a new issue if not) instead of posting a completely irrelevant comment under this issue where it'll only get lost.

@WIZARD-CXY
Copy link

gocode close and go get -u github.com/nsf/gocode works

@Krognol
Copy link

Krognol commented Sep 24, 2016

I've tried gocode close and go get -u github.com/nsf/gocode but neither have fixed this problem for me.

Running Windows 10 64 bit
Go version 1.7.1

@ghost
Copy link

ghost commented Sep 28, 2016

I was having this issue and I ran these commands
go get -u github.com/nsf/gocode
gocode close
gocode -debug -s
In that order and that fixed the issue

@Kleissner
Copy link

Kleissner commented Oct 1, 2016

Not working for me as well. I tried everything from above (including deleting all directories in my src folder and redownloading all the dependencies) but it's still not working. It's just showing "PANIC" instead of the hints.

Windows 10 64-bit, Go 1.7

Edit:
Got it working now, had to find the gocode.exe binary which is in "%GOPATH%\bin", found there the old file named "gocode.exe~" which I deleted and on the command line I typed the "gocode.exe close". Opened Visual Studio Code and it worked!

@ironpark
Copy link

ironpark commented Oct 31, 2016

if not work gocode close for you
try this solution
killall -9 gocode
go get -u github.com/nsf/gocode

@ramya-rao-a
Copy link
Contributor

Closing this issue, as we have a workaround

@sfrooster
Copy link

I'm having an issue very similar to this except code completion works, but after a time vscode becomes unusable because there are godef processes hogging the CPU. Killing them frees the cpu.

OSX Sierra, 1.7.1

@ramya-rao-a
Copy link
Contributor

@sfrooster See #541 and #503

@ghost
Copy link

ghost commented Nov 6, 2016

This seams to happen after every GO update go through the steps to kill the
barcode process to fix it

On Sat, Nov 5, 2016, 5:26 PM Ramya Rao notifications@github.com wrote:

@sfrooster https://github.com/sfrooster See #541
#541 and #503
#503


You are receiving this because you commented.
Reply to this email directly, view it on GitHub
#441 (comment),
or mute the thread
https://github.com/notifications/unsubscribe-auth/ABw0KWvqCBttHKlitcwsVQADiZgS2ciYks5q7R6XgaJpZM4JnKKL
.

@JalpeshVadgama
Copy link

For me this is how it works.

Update the go version to Go 1.7.4 and then get latest version of all the tools.
go get -u -v github.com/nsf/gocode
go get -u -v github.com/rogpeppe/godef
go get -u -v github.com/golang/lint/golint
go get -u -v github.com/lukehoban/go-outline
go get -u -v sourcegraph.com/sqs/goreturns
go get -u -v golang.org/x/tools/cmd/gorename
go get -u -v github.com/tpng/gopkgs
go get -u -v github.com/newhook/go-symbols
go get -u -v golang.org/x/tools/cmd/guru

and Then restart the machine. It will work.

@kaitroll
Copy link

kaitroll commented Jan 25, 2017

thx

@gevgev
Copy link

gevgev commented Jan 28, 2017

Neither of the above solution has worked for me:

OS X El Capitan 10.11.6 (15G1217)
go version go1.7.5 darwin/amd64
Visual Studio Code Version 1.8.1 (1.8.1)

@ramya-rao-a
Copy link
Contributor

@gevgev
Did you try killing the current running gocode daemon as per #441 (comment)
Once the gocode process is killed, run the command Go: Install Tools so that all dependent tools get updated

Are rest of the features of the Go extension working as expected?

@gevgev
Copy link

gevgev commented Jan 29, 2017

@ramya-rao-a
Yes, I tried that several times, including with restarting my machine.
Also with re-installing all go tools manually

All other features, including all pop-ups, showing types of variable or even values of variables during debugging on mouse-hover work just fine.

The intelligence on typing (i.e. fmt. ) is not working, all it shows is just PANIC.

One thing I suspect is that with the latest Go lang Mac OS installation PKG the GOROOT now is set to "/usr/local/go", it is now kind of standardized with after I believe 1.7 release.
Which is why now I need to use sudo like in below scrip to install go tools, which means that Visual Studio Code simply cannot install the tools without sudo anymore, and maybe that might be the root cause:

sudo -E -H gocode close
sudo -E -H go get -u -v github.com/nsf/gocode
sudo -E -H go get -u -v github.com/rogpeppe/godef
sudo -E -H go get -u -v github.com/golang/lint/golint
sudo -E -H go get -u -v github.com/lukehoban/go-outline
sudo -E -H go get -u -v sourcegraph.com/sqs/goreturns
sudo -E -H go get -u -v golang.org/x/tools/cmd/gorename
sudo -E -H go get -u -v github.com/tpng/gopkgs
sudo -E -H go get -u -v github.com/newhook/go-symbols
sudo -E -H go get -u -v golang.org/x/tools/cmd/guru

Output of go env:

$ go env
GOARCH="amd64"
GOBIN="/usr/local/go/bin"
GOEXE=""
GOHOSTARCH="amd64"
GOHOSTOS="darwin"
GOOS="darwin"
GOPATH="/Users/<myusernamehere>/git/go"
GORACE=""
GOROOT="/usr/local/go"
GOTOOLDIR="/usr/local/go/pkg/tool/darwin_amd64"
CC="clang"
GOGCCFLAGS="-fPIC -m64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=/var/folders/vy/415ykmkn34v8nwy49hwfgr7c0000gn/T/go-build647783471=/tmp/go-build -gno-record-gcc-switches -fno-common"
CXX="clang++"
CGO_ENABLED="1"

@ramya-rao-a
Copy link
Contributor

@gevgev I currently use go1.7.3, and I don't see the need to use sudo. Will update to go1.7.5 and get back.

Can you try running gocode from the command line to see if you get expected output?
If not, then we should take this up with gocode's author

@gevgev
Copy link

gevgev commented Jan 29, 2017

Using gocode from command line:

Test file:

package main

import (
	"fmt"
)

func main() {
	fmt.
}

command line output (expecting suggestions at cursor pos 47):

$ gocode -in="test.go" autocomplete c1
Nothing to complete.
$ gocode -in="test.go" autocomplete c2
Nothing to complete.
$ gocode -in="test.go" autocomplete c10
Found 1 candidates:
  func make(type, len[, cap]) type
$ gocode -in="test.go" autocomplete c15
Found 1 candidates:
  PANIC PANIC PANIC
$ gocode -in="test.go" autocomplete c45
Found 1 candidates:
  PANIC PANIC PANIC
$ gocode -in="test.go" autocomplete c46
Found 1 candidates:
  PANIC PANIC PANIC
$ gocode -in="test.go" autocomplete c47
Found 1 candidates:
  PANIC PANIC PANIC
$ gocode -in="test.go" autocomplete c48
Found 1 candidates:
  PANIC PANIC PANIC
$ gocode -in="test.go" autocomplete c50
Found 1 candidates:
  PANIC PANIC PANIC

Per my understanding it should have suggested fmt.Print..Printf.. Println.. etc., but looks like the only suggestion gocode has is just 'make()' function, otherwise it is either 'Nothing to complete', or 'Panic'

Hope this helps.

@gevgev
Copy link

gevgev commented Jan 30, 2017

I have worked with nsf (author of gocode )on this issue, we got that resolved:
As it turns out I had a "leftover" stale instance (dated Sep 2016) sitting there!!:

$ which -a gocode
/Users/ggevorgyan/git/go/bin/gocode
/usr/local/go/bin/gocode

Removing the old instance and restarting gocode fixed it, everything works just fine now, including command line:

$ gocode -in="test.go" autocomplete c47
Found 25 candidates:
  func Errorf(format string, a ...interface{}) error
  func Fprint(w io.Writer, a ...interface{}) (n int, err error)
  func Fprintf(w io.Writer, format string, a ...interface{}) (n int, err error)
  func Fprintln(w io.Writer, a ...interface{}) (n int, err error)
  func Fscan(r io.Reader, a ...interface{}) (n int, err error)
  func Fscanf(r io.Reader, format string, a ...interface{}) (n int, err error)
  func Fscanln(r io.Reader, a ...interface{}) (n int, err error)
  func Print(a ...interface{}) (n int, err error)
  func Printf(format string, a ...interface{}) (n int, err error)
  func Println(a ...interface{}) (n int, err error)
  func Scan(a ...interface{}) (n int, err error)
  func Scanf(format string, a ...interface{}) (n int, err error)
  func Scanln(a ...interface{}) (n int, err error)
  func Sprint(a ...interface{}) string
  func Sprintf(format string, a ...interface{}) string
  func Sprintln(a ...interface{}) string
  func Sscan(str string, a ...interface{}) (n int, err error)
  func Sscanf(str string, format string, a ...interface{}) (n int, err error)
  func Sscanln(str string, a ...interface{}) (n int, err error)
  type Formatter interface
  type GoStringer interface
  type ScanState interface
  type Scanner interface
  type State interface
  type Stringer interface

Thank you!!!

@ramya-rao-a
Copy link
Contributor

yay! glad you are unblocked @gevgev and thanks for sharing your solution.
Happy coding!

@freedomsean
Copy link

freedomsean commented Mar 3, 2017

I can not use the function of autocomplete in VSCode Insider 1.11.0. Did I miss something? I have used the above solution, but it still doesn't have any suggestion.

reinstall all reqired packages
gocode close

If I use Code 1.10.1, it will be work.

The following is my environment

VSCode Version: Code Insider 1.11.0
OS Version: Windows 7
Steps to Reproduce:

I use the same step to try it, but it still got error.

choose GOLANG environment
start coding, declare import, for example fmt
after typing fmt. and pressing space there is no dropdown hint about available methods or variables. There do not have any suggestion, even if "panic" .

@ramya-rao-a
Copy link
Contributor

@freedomsean So on the same machine, autocomplete works fine in the stable build, but not insiders?

@freedomsean
Copy link

freedomsean commented Mar 3, 2017

@ramya-rao-a Yes, It works fine in the stable build, but not insiders. Do I need to submit this issue to VSCode project?

@ramya-rao-a
Copy link
Contributor

ramya-rao-a commented Mar 3, 2017

Update: I can repro this
We can track this in #836. Please upvote/add comments in that issue

@Russtopia
Copy link

Also check if you have copies of gocode.exe both in $GOROOT/bin (or %GOROOT%\bin on Windows) and $GOPATH/bin (%GOPATH%\bin) and be sure to remove all old versions before doing

go get -u github.com/nsf/gocode

@Twitch-CultCoder
Copy link

Twitch-CultCoder commented May 26, 2017

Perfect. I had the exact same problem on windows 7 Ultimate. gocode close and go get -u github.com/nsf/gocode fixed it for me. Thanks guys. Saved me huge headaches.

@scippio
Copy link

scippio commented Nov 27, 2017

gocode close && go get -u github.com/nsf/gocode fix in insider: microsoft/vscode@89b158e

@dc0d
Copy link

dc0d commented Dec 30, 2017

Happened today, in a strange way.

How?

It did not work for a project (directory, opened with code -g -n dir). But worked for another project (Go 1.9.2, latest VSCode, Ubuntu 16.04).

I have:

  • Updated all packages needed for the extension,
  • Done gocode stop (and also killall gocode - both stopped the gocode),
  • Done gocode drop-cache (no effect),
  • And then ran gocode -debug -s.

My guess: This happens when number of candidates are more than one (in a sample case Number of candidates found: 3). There should be priority for searching for packages like:

  1. ./internal/...,
  2. ./pkg/...,
  3. ./,
  4. ../.,
  5. ../parents-and-their-children-up-to-$GOPATH/,
  6. Rest of $GOPATH (nearest neighbor? kidding!).

@ramya-rao-a Since this comes up from time to time, I guessed a comment would be more helpful than opening an issue, especially that I just have some guess and can not reproduce this, reliably. Thanks!

@dc0d
Copy link

dc0d commented Dec 31, 2017

@ramya-rao-a I've managed to reproduce it reliably.

When adding this comment with unicodes:

// 𐏃𐏂𐏁𐏀𐎿𐎾𐎽𐎼𐎻𐎺𐎹𐎸𐎷𐎶𐎵𐎴𐎳𐎲𐎱𐎰𐎯𐎮𐎭𐎬𐎫𐎪𐎩𐎨𐎧𐎦𐎥𐎤𐎣𐎢𐎡𐎠 := 1

It stops working and when this comment gets removed, it starts working.

@ramya-rao-a
Copy link
Contributor

@dc0d I'd still prefer opening a new issue than a comment here. Rest of this issue either needed a restart of gocode or the issue with VS Code insiders. Both of which are unrelated to the detailed analysis you have done.

The multiple candidates is not an issue. It just means that there are multiple completion items.

I've logged #1431 to track the issue with unicode.

@microsoft microsoft locked as resolved and limited conversation to collaborators Dec 31, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests