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

guru: command not found (but it is installed, and in my GOPATH/bin) #19

Closed
mtaufen opened this issue May 19, 2016 · 8 comments
Closed

Comments

@mtaufen
Copy link

mtaufen commented May 19, 2016

When I Ctrl + Shift + G and run a command I get, for example, the following output:

Running guru callees command...

/bin/sh: guru: command not found

Interestingly, in the startup logs it lists my GoGuru version as None:

GoGuru: ('debug:', False)
GoGuru: ('use_golangconfig', False)
GoGuru: ('version:', None)

If, in the Sublime console, I do:

import os
print (os.environ['PATH'])
print (os.environ['GOPATH'])

I at least see that my GOPATH/bin is set correctly and in my PATH, and if I:

which guru

I can see that guru is in my GOPATH/bin.

Though I have no idea if the environment printed to the console is the same one the plugin sees :P.

@alvarolm
Copy link
Owner

alvarolm commented May 19, 2016

you're correct GoGuru should by default use the same PATH that you see, could you please enable debug, restart sublime, try again and post the console logs here?

to enable debug "goguru_debug" must be set to true at the user settings
preferences > package settings > GoGuru > Settings - User

@alvarolm
Copy link
Owner

alvarolm commented May 19, 2016

I belive u have an outdated version, try removing the package and reinstalling with the latest (0.1.11)(package control is available btw),

@mtaufen
Copy link
Author

mtaufen commented May 20, 2016

Ok. Uninstalled and reinstalled. It works correctly after the reinstall, so I guess I was in fact out of date.

One other interesting thing to note, the version now doesn't show up until you restart Sublime:

The debug message after the reinstall was:

GoGuru: ('debug:', False)
GoGuru: ('use_golangconfig', False)
GoGuru: ('version:', None)

But the version is there after enabling debug and restarting Sublime:

GoGuru: ('debug:', True)
GoGuru: ('use_golangconfig', False)
GoGuru [DEBUG]: ("couldn't get git tag:", <class 'NotADirectoryError'>)
GoGuru: ('version:', '0.1.11')

And the version is still there after disabling debug and restarting again:

GoGuru: ('debug:', False)
GoGuru: ('use_golangconfig', False)
GoGuru: ('version:', '0.1.11')

In any event, everything seems to work now, so thanks for your help :).

@alvarolm
Copy link
Owner

alvarolm commented May 20, 2016

I have added a restart notice to the install notes, a4f4a86, I will look up this behavior closer next week, thanks !

#20

@mtaufen
Copy link
Author

mtaufen commented May 22, 2016

Sure thing :). Just want to say I am loving the plugin. So much nicer than the ctags hack I was using before ;-).

@jayzhou215
Copy link

I am sorry to ask the same problem again, but I really tried a lot.
Guru verison ## 0.1.7 (last line in change log)
Sublime version is 3.1.1
Tried uninstall sublime, uninstall guru.
go to definition with right click works fine, but with ctrl shift G and choose caller give an error.

GoGuru [DEBUG]: ('goguru_use_current_package', True)
GoGuru [DEBUG]: ('GOPATH', '/Users/me/Library/Application Support/Sublime Text 3/Packages/$HOME/go/bin:$PATH')
GoGuru [DEBUG]: ('local_package', '')
GoGuru [DEBUG]: ('guru_scope', ',')
GoGuru [DEBUG]: ('cmd', 'guru -scope , -tags ""  callers /Users/me/go/src/path/to/file.go:#8167,#8191')
GoGuru [ERROR]: ('/bin/sh: guru: command not found\n',)

in terminal

➜  ~ which go
/usr/local/bin/go
➜  ~ which guru
guru not found
➜  ~ cd go/bin 
➜  bin guru
Run 'guru -help' for more information.

in user setting file

{
	"goguru_debug": true,
	"goguru_env": {"GOPATH": "$HOME/go/bin:$PATH"}
}

@kylebebak
Copy link

kylebebak commented Aug 1, 2018

@jayzhou215

I was having the same problem, with the same debug information being printed to the console by GoGuru. I resolved it by adding a PATH variable in goguru_env. It should be the path to the bin directory containing the guru executable.

Also worth mentioning: I extracted GoGuru to make debugging easier, and throwing some print statements into the plugin I found that env vars such as $HOME aren't necessarily expanded when you run GoGuru. In other words, specify the path from the root of your file system without using env vars.

{
	"goguru_debug": false,
  "goguru_env": { // goguru doens't expand env vars for these paths
    "GOPATH": "/Users/kylebebak/Code/go", "PATH": "/Users/kylebebak/Code/go/bin"
  },
}

@alvarolm
The first point, that GOPATH and PATH should both be specified inside goguru_env, is probably worth adding to the documentation.

@alvarolm
Copy link
Owner

alvarolm commented Nov 27, 2019

@kylebebak it is

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants