alvarolm / goguru Goto Github PK
View Code? Open in Web Editor NEWGoGuru is a Golang plugin for SublimeText 3 that integrates the Go guru tool.
Home Page: http://alvarolm.github.io/GoGuru
License: MIT License
GoGuru is a Golang plugin for SublimeText 3 that integrates the Go guru tool.
Home Page: http://alvarolm.github.io/GoGuru
License: MIT License
// env overwrites the default shell environment vars
// e.g "env": { "GOPATH": "$HOME/go/bin:$PATH" }
// not used when goguru_use_golangconfig is set to true
"goguru_env": {},
These lines from Default.sublime-settings
are confusing. The $GOPATH
env should not be set to $HOME/go/bin
. $GOPATH
is the parent of the directory containing all the Go binaries.
Running guru definition command...
guru: cannot find package "github.com/sirupsen/logrus" in any of:
/Users/Eurus/U/dev/goroot/src/github.com/sirupsen/logrus (from $GOROOT)
($GOPATH not set. For more details see: 'go help gopath')
go get github.com/sirupsen/logrus
(Installs to $GOROOT/pkg/mod
)logrus.StandardLogger()
StandardLogger
{
"goguru_debug": true,
"goguru_output": "buffer",
"goguru_jumpto_definition": true,
}
GoGuru [DEBUG]: ('cmd_env', {'GOROOT': '/Users/Eurus/U/dev/goroot', 'PWD': '/Applications/Sublime Text.app/Contents/MacOS', 'XPC_FLAGS': '0x0', 'GOPATH': '/Users/Eurus/U/dev/goroot', '__CF_USER_TEXT_ENCODING': '0x1F5:0x0:0x0', 'SHELL': '/bin/bash', '__CFBundleIdentifier': 'com.sublimetext.4', 'PATH': '~/U/dev/go1.18/bin:~/U/exe:~/Documents/Dev/PocketMine-MP/4/bin/php7/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/MacGPG2/bin:~/U/dev/go1.18/bin:~/U/exe:~/Documents/Dev/PocketMine-MP/4/bin/php7/bin:/Users/Eurus/U/dev/goroot/bin', 'XPC_SERVICE_NAME': '0', 'STARSHIP_SHELL': 'bash', 'HOME': '/Users/Eurus', 'COMMAND_MODE': 'unix2003', '_': '/usr/bin/env\n\x1b[48;5;4;38;5;15m \x1b[0m\x1b[48;5;4;38;5;15m/Applications/Sublime Text.app/Contents/MacOS\x1b[0m\x1b[48;5;4;38;5;15m \x1b[0m\x1b[48;5;6;38;5;4m\ue0b0\x1b[0m\x1b[48;5;8;38;5;6m\ue0b0\x1b[0m\x1b[38;5;8m\ue0b0\x1b[0m \x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08logout', 'TMPDIR': '/var/folders/ss/jlr803w55s7gxqgb8gd7kv_r0000gn/T/', 'LOGNAME': 'Eurus', 'SSL_CERT_FILE': '/Applications/Sublime Text.app/Contents/MacOS/Lib/python3/certifi/cacert.pem', 'SHLVL': '1', 'SSH_AUTH_SOCK': '/private/tmp/com.apple.launchd.P0qObF4omF/Listeners', 'USER': 'Eurus', 'STARSHIP_SESSION_KEY': '2773020636708932'})
GoGuru [DEBUG]: ('goguru_env', {})
GoGuru [DEBUG]: ('final_env', {'GOROOT': '/Users/Eurus/U/dev/goroot', 'PWD': '/Applications/Sublime Text.app/Contents/MacOS', 'XPC_FLAGS': '0x0', 'GOPATH': '/Users/Eurus/U/dev/goroot', '__CF_USER_TEXT_ENCODING': '0x1F5:0x0:0x0', 'SHELL': '/bin/bash', '__CFBundleIdentifier': 'com.sublimetext.4', 'PATH': '~/U/dev/go1.18/bin:~/U/exe:~/Documents/Dev/PocketMine-MP/4/bin/php7/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/MacGPG2/bin:~/U/dev/go1.18/bin:~/U/exe:~/Documents/Dev/PocketMine-MP/4/bin/php7/bin:/Users/Eurus/U/dev/goroot/bin', 'XPC_SERVICE_NAME': '0', 'STARSHIP_SHELL': 'bash', 'HOME': '/Users/Eurus', 'COMMAND_MODE': 'unix2003', '_': '/usr/bin/env\n\x1b[48;5;4;38;5;15m \x1b[0m\x1b[48;5;4;38;5;15m/Applications/Sublime Text.app/Contents/MacOS\x1b[0m\x1b[48;5;4;38;5;15m \x1b[0m\x1b[48;5;6;38;5;4m\ue0b0\x1b[0m\x1b[48;5;8;38;5;6m\ue0b0\x1b[0m\x1b[38;5;8m\ue0b0\x1b[0m \x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08logout', 'TMPDIR': '/var/folders/ss/jlr803w55s7gxqgb8gd7kv_r0000gn/T/', 'LOGNAME': 'Eurus', 'SSL_CERT_FILE': '/Applications/Sublime Text.app/Contents/MacOS/Lib/python3/certifi/cacert.pem', 'SHLVL': '1', 'SSH_AUTH_SOCK': '/private/tmp/com.apple.launchd.P0qObF4omF/Listeners', 'USER': 'Eurus', 'STARSHIP_SESSION_KEY': '2773020636708932'})
GoGuru [DEBUG]: ('goguru_use_current_package', True)
GoGuru [DEBUG]: ('GOPATH', '/Volumes/NO NAME/dev/goroot')
GoGuru [DEBUG]: ('local_package', '')
GoGuru [DEBUG]: ('guru_scope', ',')
GoGuru [DEBUG]: ('cmd', 'guru -modified -scope , -tags "" definition /Users/Eurus/Documents/Dev/Go/github.com/Endermanbugzjfc/MlogGo/tview/main.go:#235,#249')
GoGuru [ERROR]: ('guru: cannot find package "github.com/sirupsen/logrus" in any of:\n\t/Users/Eurus/U/dev/goroot/src/github.com/sirupsen/logrus (from $GOROOT)\n\t($GOPATH not set. For more details see: \'go help gopath\')\n',)
OS: macOS 12.1
Sublime Text: (Unregistered) Stable Channel, Build 4126
GoGuru Executable Sha256: 77f0b981f63254d080a12f4f0693efa1bac4f864a1b1123f2e5768327f580a54
I am using Sublimetext 3 with few plugins to help me write code. GoGuru is one of them, but after the weekend i noticed that GoGuru and gometalinter were not working properly anymore.
I have setup a shortcut key "CTRL+D" to go to definition, which displays following error: "GoGuru [ERROR]: ('guru: no identifier here\n',)". I did notice something strange. When i attempt to go to definition of getSession, it opens the PostFormValue function from request.go, which is definetly not what i was looking for. So i guess, it means that goguru cursor location is different from the real one. I am really lost here, updated everything, reinstalled Sublime, still same errors. This happens on both of my computers.
Mac OS X 10.11.6
Sublime 3126 (latest stable)
I can't edit key binding file - it shows an error Unable to open /Users/mwf/Library/Application Support/Sublime Text 3/Packages/GoGuru/Default (OSX).sublime-keymap
There is really no such file - not even "GoGuru" dir under packages. But it opens the file somehow in read-only mode - don't know where it takes from.
Maybe from the package source file - /Users/mwf/Library/Application Support/Sublime Text 3/Installed Packages/GoGuru.sublime-package
Please check if the package installation works well and the package is unpacked to Packages/GoGuru
First, thanks for your efforts here - I've been looking forward to seeing adonovan's recent hard work on guru integrated into Sublime Text! I'll play with this as soon as I have some time, but quick feedback after reviewing the install notes:
It looks like you are rolling your own mechanism for managing GOPATH etc. I'd highly suggest trying to leverage the official golangconfig dependency, that was recently added to help create a good ecosystem for Go-related packages in Sublime Text. Then users only have to configure one set of things globally or per-project as appropriate, and this package, the Golang Build package, and any other packages can make use of them.
Standard configuration, no configuration file changed.
flag provided but not defined: -format
Run 'guru -help' for more information.
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.
Alvaro has been quiet for the last few days. Maybe he's tied up with work commitments, I don't know. But could anyone else have a look at my unresolved issue #33
Thanks,
Carl
It loads the User.sublime-settings but I cannot edit it. It seems it is locked into some read-only mode.
ST3 build 3112 - MacOS X
Same as #13
I just installed and am using stock configuration. For some reason its not taking my GOPATH environment variable, or something. From the sublime console:
GoGuru [ERROR]: ('open /Applications/Sublime Text.app/Contents/hail/src/common/app: no such file or directory\nguru: no initial packages were loaded\n',)
When I run most any guru command from GoGuru, i'm gettin a ton of errors like this:
/Users/macrael/code/go/src/github.com/18F/e-QIP-prototype/api/eqip/security.go:9:2: could not import crypto/x509 (cannot find package "crypto/x509" in any of:
/Users/macrael/code/go/src/github.com/18F/e-QIP-prototype/api/vendor/crypto/x509 (vendor tree)
/usr/local/Cellar/go/1.8.1/libexec/src/crypto/x509 (from $GOROOT)
/Users/macrael/code/go/src/crypto/x509 (from $GOPATH))
I think that these are all standard library packages but i'm running go 1.10.1 so it's not finding anything in 1.8.1
In my shell, go env GOROOT returns the 1.10.1 path, and I have goguru_use_golangconfig set to false like the default.
Any tips?
To reproduce:
I'm on ST3 build 3103 on OS X El Capitan.
Hi, I've installed Go Guru and the sublime plug-in. I've moves the compiled guru.exe to mt GOPATH (in this case C:\Go\Bin) and tried to use it with Ctrl-Shift G and Implements over the highlighted text "Stringer". This just results in the console showing "Running guru implements command..." but nothing is outputted. I'm sure it's something obvious I've forgotten to do, but what?!
I have altered "use_golangconfig" to true but that hasn't made any difference.
Thanks in advance,
Carl
Fixing PR on the way.
We have a monorepo (one repo many projects) that uses vendoring. I've gotten the tool to the point of working, but it can never find any of the vendored code. Example error:
/Users/rk/go/hail/src/services/api/handlers/add_credit_card_handler_test.go:8:4: could not import github.com/onsi/ginkgo (cannot find package "github.com/onsi/ginkgo" in any of:
/usr/local/Cellar/go/1.6.2/libexec/src/github.com/onsi/ginkgo (from $GOROOT)
/Users/rk/go/hail/src/github.com/onsi/ginkgo (from $GOPATH))
That code is at /Users/rk/go/hail/src/vendor/github.com/onsi/ginkgo, which should be found if vendoring is turned on.
No callers in other packages were found.
Env:
OS X 10.11
Sublime Text 3 Build 3113
My problem:
Pressing down the default hotkey "Ctrl+shift+g" would make the current line blinks without popping up the guru window. Console output:
Unable to open /Users/me/Library/Application Support/Sublime Text 3/Packages/GoGuru/Default.sublime-settings
Traceback (most recent call last):
File "/Applications/Sublime Text.app/Contents/MacOS/sublime_plugin.py", line 231, in run_callback
expr()
File "/Applications/Sublime Text.app/Contents/MacOS/sublime_plugin.py", line 327, in <lambda>
run_callback('on_activated', callback, lambda: callback.on_activated(v))
File "trailing_spaces in /Users/me/Library/Application Support/Sublime Text 3/Installed Packages/TrailingSpaces.sublime-package", line 419, in on_activated
File "trailing_spaces in /Users/me/Library/Application Support/Sublime Text 3/Installed Packages/TrailingSpaces.sublime-package", line 440, in freeze_last_version
File "./python3.3/codecs.py", line 896, in open
FileNotFoundError: [Errno 2] No such file or directory: '/Users/me/Library/Application Support/Sublime Text 3/Packages/GoGuru/Default.sublime-settings'
GoGuru plugin didn't create the corresponding directory on my system, tried to reinstall several times without luck.
Feature request.
When calling goguru definition, instead of return goguru's output, it could jump straight to the file with the definition.
The default $GOPATH is $HOME/go. Instead of failing silently, you should fallback to $HOME/go in the event that $GOPATH is not set.
Env:
MaxOSX 10.11.5
Sublime Text 3 Build 3114
I got error when I press ctrl+shift+g
and select any function:
File "goGuru in /Users/zlx/Library/Application Support/Sublime Text 3/Installed Packages/GoGuru.sublime-package", line 210, in guru
ValueError: dictionary update sequence element #0 has length 1; 2 is required
When is this going to be available in Sublime? Why is it taking so long to get it into the manager? Is there another way to install it in Sublime without using the package manager?
After installation it doesn't work because shellenv package is missing:
import sublime, sublime_plugin, subprocess, time, re, os, subprocess, sys, shellenv
ImportError: No module named 'shellenv'
reloading plugin GoGuru.goGuru
Traceback (most recent call last):
File "/Applications/Sublime Text.app/Contents/MacOS/sublime_plugin.py", line 120, in reload_plugin
m.plugin_loaded()
File "goGuru in /Users/uldericofilho/Library/Application Support/Sublime Text 3/Installed Packages/GoGuru.sublime-package", line 57, in plugin_loaded
File "goGuru in /Users/uldericofilho/Library/Application Support/Sublime Text 3/Installed Packages/GoGuru.sublime-package", line 43, in load_shellenv
ImportError: No module named 'shellenv'
hello:
when i used GoGuru .The following is an error message
open x:\xxx|xxx|xxx: The system cannot find the path specified.
guru: no initial packages were loaded
what should i do
thanks.
As FichteFoll stated (wbond/package_control_channel#5443 (comment)):
You can import modules relative to your package (in ST3) using a relative import, such as from .dep import shellenv. Also note that dep/shellenv/ contains .pyc files, which will be ignored by ST.
I think this doesn't work. Since if I press ctrl+g directly, it still jumps.
It might be better to replace it with ["ctrl+.", "ctrl+g"] instead.
This is frustrating -- waiting for the package manager to "allow" this. I would have made the post once it was actually usable by the package manager. In other words, I really want it!
Is there another way to install it w/o using package install?
Hi
I am getting the following error when trying to use GoGuru on Mac
I get the following exception in sublime's console when attempting to run any go guru commands:
Traceback (most recent call last):
File "goGuru in /Users/kaixiang/Library/Application Support/Sublime Text 3/Installed Packages/GoGuru.sublime-package", line 143, in on_done
File "goGuru in /Users/kaixiang/Library/Application Support/Sublime Text 3/Installed Packages/GoGuru.sublime-package", line 323, in guru
File "dep.shellenv._osx in /Users/kaixiang/Library/Application Support/Sublime Text 3/Installed Packages/GoGuru.sublime-package", line 29, in get_env
File "dep.shellenv._posix in /Users/kaixiang/Library/Application Support/Sublime Text 3/Installed Packages/GoGuru.sublime-package", line 58, in get_shell_env
File "./python3.3/subprocess.py", line 819, in init
File "./python3.3/subprocess.py", line 1448, in _execute_child
FileNotFoundError: [Errno 2] No such file or directory: '/bin/false'
I installed the GoGuru plugin using package control and the guru command. I ran a few commands in GoGuru and everything worked fine. Then for other reasons I restarted Sublime Text and now it says it's running the guru command but it never terminates and I never get any output.
Running guru callers command...
This is likely a problem with my installation, but have you seen this before?
I have a similar problem as this: #19
I have Sublime Text 3 (registered) and GoGuru version 1.1.14
GoGuru (or Sublime) doesn't detect my system $GOPATH and $PATH.
Here is what I see in the console:
GoGuru: ('debug:', True)
GoGuru: ('use_golangconfig', False)
GoGuru [DEBUG]: ("couldn't get git tag:", <class 'NotADirectoryError'>)
GoGuru: ('version:', '0.1.14')
Package Control: Skipping automatic upgrade, last run at 2018-03-02 14:17:47, next run at 2018-03-02 15:17:47 or after
environment variables loaded using: /bin/zsh -l
>>> import os;
>>> print (os.environ['PATH'])
/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin
>>> print (os.environ['GOPATH'])
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "./python3.3/os.py", line 656, in __getitem__
KeyError: 'GOPATH'
In addition to this, the only packages I have installed in my Sublime is GoGuru and Package Installar, just to isolate the problem.
Any ideas as to why my system $GOPATH and $PATH is not being detected?
In my terminal $GOPATH and $PATH are properly set.
The other thing I tried was setting $GOPATH and $PATH in goguru_env
, then made a call and got this error:
/bin/sh: guru: command not found
. I don't know if it matters, but my default shell is zsh
.
Thanks in advance for the help.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.