alvarolm / GoGuru

GoGuru is a Golang plugin for SublimeText 3 that integrates the Go guru tool.
http://alvarolm.github.io/GoGuru
MIT License
82 stars 9 forks source link

Go Guru not working aka I've done something wrong! #33

Closed carlca closed 7 years ago

carlca commented 7 years ago

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

carlca commented 7 years ago

Versions are: Go - 1.8 Guru - 0.1.14

alvarolm commented 7 years ago

Hi! :) Ṕlease set "goguru_debug" to true an then let us take a look at the logs. https://github.com/alvarolm/GoGuru/issues/18#issuecomment-219128789

carlca commented 7 years ago

Extract of log file. I can see a GoGuru error at the end, but you're the expert I'll leave it to you... :-)

GoGuru [ERROR]: ("couldn't import golangconfig:", <class 'ImportError'>)
GoGuru: ('using shellenv instead of golangconfig',)
GoGuru: ('debug:', True)
GoGuru: ('use_golangconfig', True)
GoGuru [DEBUG]: ("couldn't get git tag:", <class 'NotADirectoryError'>)
GoGuru: ('version:', '0.1.14')
GoGuru [ERROR]: ('golangconfig:', (<class 'NameError'>, NameError("global name 'golangconfig' is not defined",), <traceback object at 0x00000244972AED88>))
carlca commented 7 years ago

I reset "use_golangconfig" to false and the log file looks healthier but I'm not seeing any output...

GoGuru: ('debug:', True)
GoGuru: ('use_golangconfig', False)
GoGuru [DEBUG]: ("couldn't get git tag:", <class 'NotADirectoryError'>)
GoGuru: ('version:', '0.1.14')
GoGuru [DEBUG]: ('cmd_env', {'GTK_BASEPATH': 'C:\\Program Files (x86)\\GtkSharp\\2.12\\', 'NUMBER_OF_PROCESSORS': '4', 'LOGONSERVER': '\\\\CARL-PC', 'COMMONPROGRAMW6432': 'C:\\Program Files\\Common Files', 'OS': 'Windows_NT', 'PROCESSOR_REVISION': '2a07', 'CHOCOLATEYINSTALL': 'C:\\ProgramData\\chocolatey', 'SESSIONNAME': 'Console', 'FP_NO_HOST_CHECK': 'NO', 'LOCALAPPDATA': 'C:\\Users\\Carl\\AppData\\Local', 'USERNAME': 'Carl', 'SYSTEMROOT': 'C:\\WINDOWS', 'PROCESSOR_LEVEL': '6', 'COMMONPROGRAMFILES': 'C:\\Program Files\\Common Files', 'TEMP': 'C:\\Users\\Carl\\AppData\\Local\\Temp', 'VS120COMNTOOLS': 'C:\\Program Files (x86)\\Microsoft Visual Studio 12.0\\Common7\\Tools\\', 'USERDOMAIN': 'CARL-PC', 'CHOCOLATEYLASTPATHUPDATE': 'Sat Mar  4 09:06:49 2017', 'PROCESSOR_ARCHITECTURE': 'AMD64', 'ONEDRIVE': 'C:\\Users\\Carl\\OneDrive', 'PROGRAMW6432': 'C:\\Program Files', 'APPDATA': 'C:\\Users\\Carl\\AppData\\Roaming', 'CHOCOLATEY_BIN_ROOT': '\\tools', 'TMP': 'C:\\Users\\Carl\\AppData\\Local\\Temp', 'HEROKUPATH': 'C:\\Program Files (x86)\\Heroku', 'VBOX_MSI_INSTALL_PATH': 'C:\\Program Files\\Oracle\\VirtualBox\\', 'PUBLIC': 'C:\\Users\\Public', 'SYSTEMDRIVE': 'C:', 'HOMEPATH': '\\Users\\Carl', 'CABBAGE_OPCODE_PATH64': 'C:\\Program Files\\Cabbage64', 'WINDIR': 'C:\\WINDOWS', 'COMSPEC': 'C:\\WINDOWS\\system32\\cmd.exe', 'FPS_BROWSER_USER_PROFILE_STRING': 'Default', 'COMPUTERNAME': 'CARL-PC', 'PATH': 'C:\\Python36;C:\\Python36\\Scripts;C:\\Program Files\\Docker\\Docker\\Resources\\bin;C:\\ProgramData\\Oracle\\Java\\javapath;C:\\Program Files (x86)\\CollabNet;C:\\Program Files\\Common Files\\Microsoft Shared\\Windows Live;C:\\Program Files (x86)\\Common Files\\Microsoft Shared\\Windows Live;C:\\WINDOWS\\system32;C:\\WINDOWS;C:\\WINDOWS\\System32\\Wbem;C:\\WINDOWS\\System32\\WindowsPowerShell\\v1.0\\;C:\\Program Files (x86)\\EgisTec MyWinLocker\\x86;C:\\Program Files (x86)\\EgisTec MyWinLocker\\x64;C:\\Program Files (x86)\\Windows Live\\Shared;C:\\Program Files (x86)\\Microsoft SQL Server\\100\\Tools\\Binn\\;C:\\Program Files\\Microsoft SQL Server\\100\\Tools\\Binn\\;C:\\Program Files\\Microsoft SQL Server\\100\\DTS\\Binn\\;C:\\Program Files (x86)\\GtkSharp\\2.12\\bin;C:\\lazarus\\fpc\\3.0.0\\bin\\x86_64-win64;C:\\Program Files\\Microsoft SQL Server\\120\\Tools\\Binn\\;C:\\Program Files\\Microsoft SQL Server\\130\\Tools\\Binn\\;C:\\WINDOWS\\system32\\config\\systemprofile\\.dnx\\bin;C:\\Program Files\\Microsoft DNX\\Dnvm\\;C:\\Program Files (x86)\\Windows Kits\\8.1\\Windows Performance Toolkit\\;C:\\Program Files (x86)\\Microsoft Emulator Manager\\1.0\\;C:\\Program Files (x86)\\Heroku\\bin;C:\\Program Files (x86)\\git\\cmd;C:\\Program Files (x86)\\RemObjects Software\\Elements\\bin;C:\\Program Files (x86)\\Brackets\\command;C:\\ProgramData\\chocolatey\\bin;C:\\Program Files (x86)\\PuTTY\\;C:\\Program Files\\nodejs\\;C:\\dev\\msys64\\mingw64\\bin;C:\\dev\\msys64\\mingw32\\bin;C:\\Lua;C:\\Go\\bin;C:\\Delphi7\\bin;C:\\Delphi7\\Projects\\BPL;C:\\Program Files\\TortoiseGit\\bin;C:\\PSTools;C:\\Program Files\\Git\\Bin;C:\\Program Files\\Sublime Text 3;C:\\Python36\\Scripts\\;C:\\Python36\\;C:\\Users\\Public\\Documents\\Embarcadero\\Studio\\18.0\\Bpl;C:\\Program Files (x86)\\Microsoft VS Code\\bin;C:\\Users\\Carl\\AppData\\Local\\Microsoft\\WindowsApps;C:\\Users\\Carl\\AppData\\Roaming\\Dashlane\\4.6.5.21982\\bin\\Firefox_Extension\\{442718d9-475e-452a-b3e1-fb1ee16b8e9f}\\components;C:\\Users\\Carl\\AppData\\Roaming\\Dashlane\\4.6.6.23032\\bin\\Firefox_Extension\\{442718d9-475e-452a-b3e1-fb1ee16b8e9f}\\components;C:\\Python27;C:\\Users\\Carl\\AppData\\Local\\Google\\Chrome\\Application;C:\\Users\\Carl\\AppData\\Roaming\\npm;C:\\Go\\Bin;C:\\gocode\\bin;C:\\Users\\Carl\\AppData\\Roaming\\Dashlane\\4.6.8.26847\\bin\\Firefox_Extension\\{442718d9-475e-452a-b3e1-fb1ee16b8e9f}\\components;C:\\Users\\Carl\\AppData\\Local\\Google\\Cloud SDK\\google-cloud-sdk\\bin;%SUBLIME%;', 'VS100COMNTOOLS': 'C:\\Program Files (x86)\\Microsoft Visual Studio 10.0\\Common7\\Tools\\', 'PROGRAMFILES': 'C:\\Program Files', 'HOMEDRIVE': 'C:', 'GOPATH': 'c:\\gocode\\', 'PROCESSOR_IDENTIFIER': 'Intel64 Family 6 Model 42 Stepping 7, GenuineIntel', 'USERDOMAIN_ROAMINGPROFILE': 'CARL-PC', 'PROGRAMDATA': 'C:\\ProgramData', 'FPS_BROWSER_APP_PROFILE_STRING': 'Internet Explorer', 'ALLUSERSPROFILE': 'C:\\ProgramData', 'VS140COMNTOOLS': 'C:\\Program Files (x86)\\Microsoft Visual Studio 14.0\\Common7\\Tools\\', 'VS110COMNTOOLS': 'C:\\Program Files (x86)\\Microsoft Visual Studio 11.0\\Common7\\Tools\\', 'PATHEXT': '.COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH;.MSC', 'TOUCHAPPSTARGETDIR': 'C:\\Program Files (x86)\\Microsoft Touch Pack for Windows 7\\', 'ANDROID_NDK_PATH': 'C:\\Users\\Carl\\Documents\\Android\\ndk\\android-ndk-r10e', 'PROGRAMFILES(X86)': 'C:\\Program Files (x86)', 'PSMODULEPATH': 'C:\\Users\\Carl\\Documents\\WindowsPowerShell\\Modules;C:\\Users\\Carl\\AppData\\Local\\Google\\Cloud SDK\\google-cloud-sdk\\platform\\PowerShell', 'COMMONPROGRAMFILES(X86)': 'C:\\Program Files (x86)\\Common Files', 'DASHLANE_DLL_DIR': 'C:\\Users\\Carl\\AppData\\Roaming\\Dashlane\\4.6.8.26847\\bin\\Firefox_Extension\\{442718d9-475e-452a-b3e1-fb1ee16b8e9f}\\components', 'SHEAPTRC': 'log=heap.trc', 'CLINK_DIR': 'C:\\Program Files (x86)\\clink\\0.4.8', 'CORONA_SDK_SIMULATOR_PATH': 'C:\\Corona SDK', 'GOROOT': 'C:\\Go\\', 'USERPROFILE': 'C:\\Users\\Carl'})
GoGuru [DEBUG]: ('goguru_env', {})
GoGuru [DEBUG]: ('final_env', {'GTK_BASEPATH': 'C:\\Program Files (x86)\\GtkSharp\\2.12\\', 'NUMBER_OF_PROCESSORS': '4', 'LOGONSERVER': '\\\\CARL-PC', 'COMMONPROGRAMW6432': 'C:\\Program Files\\Common Files', 'OS': 'Windows_NT', 'PROCESSOR_REVISION': '2a07', 'CHOCOLATEYINSTALL': 'C:\\ProgramData\\chocolatey', 'SESSIONNAME': 'Console', 'FP_NO_HOST_CHECK': 'NO', 'LOCALAPPDATA': 'C:\\Users\\Carl\\AppData\\Local', 'USERNAME': 'Carl', 'SYSTEMROOT': 'C:\\WINDOWS', 'PROCESSOR_LEVEL': '6', 'COMMONPROGRAMFILES': 'C:\\Program Files\\Common Files', 'TEMP': 'C:\\Users\\Carl\\AppData\\Local\\Temp', 'VS120COMNTOOLS': 'C:\\Program Files (x86)\\Microsoft Visual Studio 12.0\\Common7\\Tools\\', 'USERDOMAIN': 'CARL-PC', 'CHOCOLATEYLASTPATHUPDATE': 'Sat Mar  4 09:06:49 2017', 'PROCESSOR_ARCHITECTURE': 'AMD64', 'ONEDRIVE': 'C:\\Users\\Carl\\OneDrive', 'PROGRAMW6432': 'C:\\Program Files', 'APPDATA': 'C:\\Users\\Carl\\AppData\\Roaming', 'CHOCOLATEY_BIN_ROOT': '\\tools', 'TMP': 'C:\\Users\\Carl\\AppData\\Local\\Temp', 'HEROKUPATH': 'C:\\Program Files (x86)\\Heroku', 'VBOX_MSI_INSTALL_PATH': 'C:\\Program Files\\Oracle\\VirtualBox\\', 'PUBLIC': 'C:\\Users\\Public', 'SYSTEMDRIVE': 'C:', 'HOMEPATH': '\\Users\\Carl', 'CABBAGE_OPCODE_PATH64': 'C:\\Program Files\\Cabbage64', 'WINDIR': 'C:\\WINDOWS', 'COMSPEC': 'C:\\WINDOWS\\system32\\cmd.exe', 'FPS_BROWSER_USER_PROFILE_STRING': 'Default', 'COMPUTERNAME': 'CARL-PC', 'PATH': 'C:\\Python36;C:\\Python36\\Scripts;C:\\Program Files\\Docker\\Docker\\Resources\\bin;C:\\ProgramData\\Oracle\\Java\\javapath;C:\\Program Files (x86)\\CollabNet;C:\\Program Files\\Common Files\\Microsoft Shared\\Windows Live;C:\\Program Files (x86)\\Common Files\\Microsoft Shared\\Windows Live;C:\\WINDOWS\\system32;C:\\WINDOWS;C:\\WINDOWS\\System32\\Wbem;C:\\WINDOWS\\System32\\WindowsPowerShell\\v1.0\\;C:\\Program Files (x86)\\EgisTec MyWinLocker\\x86;C:\\Program Files (x86)\\EgisTec MyWinLocker\\x64;C:\\Program Files (x86)\\Windows Live\\Shared;C:\\Program Files (x86)\\Microsoft SQL Server\\100\\Tools\\Binn\\;C:\\Program Files\\Microsoft SQL Server\\100\\Tools\\Binn\\;C:\\Program Files\\Microsoft SQL Server\\100\\DTS\\Binn\\;C:\\Program Files (x86)\\GtkSharp\\2.12\\bin;C:\\lazarus\\fpc\\3.0.0\\bin\\x86_64-win64;C:\\Program Files\\Microsoft SQL Server\\120\\Tools\\Binn\\;C:\\Program Files\\Microsoft SQL Server\\130\\Tools\\Binn\\;C:\\WINDOWS\\system32\\config\\systemprofile\\.dnx\\bin;C:\\Program Files\\Microsoft DNX\\Dnvm\\;C:\\Program Files (x86)\\Windows Kits\\8.1\\Windows Performance Toolkit\\;C:\\Program Files (x86)\\Microsoft Emulator Manager\\1.0\\;C:\\Program Files (x86)\\Heroku\\bin;C:\\Program Files (x86)\\git\\cmd;C:\\Program Files (x86)\\RemObjects Software\\Elements\\bin;C:\\Program Files (x86)\\Brackets\\command;C:\\ProgramData\\chocolatey\\bin;C:\\Program Files (x86)\\PuTTY\\;C:\\Program Files\\nodejs\\;C:\\dev\\msys64\\mingw64\\bin;C:\\dev\\msys64\\mingw32\\bin;C:\\Lua;C:\\Go\\bin;C:\\Delphi7\\bin;C:\\Delphi7\\Projects\\BPL;C:\\Program Files\\TortoiseGit\\bin;C:\\PSTools;C:\\Program Files\\Git\\Bin;C:\\Program Files\\Sublime Text 3;C:\\Python36\\Scripts\\;C:\\Python36\\;C:\\Users\\Public\\Documents\\Embarcadero\\Studio\\18.0\\Bpl;C:\\Program Files (x86)\\Microsoft VS Code\\bin;C:\\Users\\Carl\\AppData\\Local\\Microsoft\\WindowsApps;C:\\Users\\Carl\\AppData\\Roaming\\Dashlane\\4.6.5.21982\\bin\\Firefox_Extension\\{442718d9-475e-452a-b3e1-fb1ee16b8e9f}\\components;C:\\Users\\Carl\\AppData\\Roaming\\Dashlane\\4.6.6.23032\\bin\\Firefox_Extension\\{442718d9-475e-452a-b3e1-fb1ee16b8e9f}\\components;C:\\Python27;C:\\Users\\Carl\\AppData\\Local\\Google\\Chrome\\Application;C:\\Users\\Carl\\AppData\\Roaming\\npm;C:\\Go\\Bin;C:\\gocode\\bin;C:\\Users\\Carl\\AppData\\Roaming\\Dashlane\\4.6.8.26847\\bin\\Firefox_Extension\\{442718d9-475e-452a-b3e1-fb1ee16b8e9f}\\components;C:\\Users\\Carl\\AppData\\Local\\Google\\Cloud SDK\\google-cloud-sdk\\bin;%SUBLIME%;', 'VS100COMNTOOLS': 'C:\\Program Files (x86)\\Microsoft Visual Studio 10.0\\Common7\\Tools\\', 'PROGRAMFILES': 'C:\\Program Files', 'HOMEDRIVE': 'C:', 'GOPATH': 'c:\\gocode\\', 'PROCESSOR_IDENTIFIER': 'Intel64 Family 6 Model 42 Stepping 7, GenuineIntel', 'USERDOMAIN_ROAMINGPROFILE': 'CARL-PC', 'PROGRAMDATA': 'C:\\ProgramData', 'FPS_BROWSER_APP_PROFILE_STRING': 'Internet Explorer', 'ALLUSERSPROFILE': 'C:\\ProgramData', 'VS140COMNTOOLS': 'C:\\Program Files (x86)\\Microsoft Visual Studio 14.0\\Common7\\Tools\\', 'VS110COMNTOOLS': 'C:\\Program Files (x86)\\Microsoft Visual Studio 11.0\\Common7\\Tools\\', 'PATHEXT': '.COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH;.MSC', 'TOUCHAPPSTARGETDIR': 'C:\\Program Files (x86)\\Microsoft Touch Pack for Windows 7\\', 'ANDROID_NDK_PATH': 'C:\\Users\\Carl\\Documents\\Android\\ndk\\android-ndk-r10e', 'PROGRAMFILES(X86)': 'C:\\Program Files (x86)', 'PSMODULEPATH': 'C:\\Users\\Carl\\Documents\\WindowsPowerShell\\Modules;C:\\Users\\Carl\\AppData\\Local\\Google\\Cloud SDK\\google-cloud-sdk\\platform\\PowerShell', 'COMMONPROGRAMFILES(X86)': 'C:\\Program Files (x86)\\Common Files', 'DASHLANE_DLL_DIR': 'C:\\Users\\Carl\\AppData\\Roaming\\Dashlane\\4.6.8.26847\\bin\\Firefox_Extension\\{442718d9-475e-452a-b3e1-fb1ee16b8e9f}\\components', 'SHEAPTRC': 'log=heap.trc', 'CLINK_DIR': 'C:\\Program Files (x86)\\clink\\0.4.8', 'CORONA_SDK_SIMULATOR_PATH': 'C:\\Corona SDK', 'GOROOT': 'C:\\Go\\', 'USERPROFILE': 'C:\\Users\\Carl'})
GoGuru [DEBUG]: ('goguru_use_current_package', True)
GoGuru [DEBUG]: ('GOPATH', 'c:\\gocode\\src')
GoGuru [DEBUG]: ('local_package', 'github.com/carlca/types/nodes')
GoGuru [DEBUG]: ('guru_scope', ',github.com/carlca/types/nodes')
GoGuru [DEBUG]: ('cmd', 'guru -scope ,github.com/carlca/types/nodes -tags ""  callers C:\\gocode\\src\\github.com\\carlca\\types\\nodes\\nodes.go:#1067,#1074')
carlca commented 7 years ago

Would it help if I trimmed the copy and pasted log file? If so, which bits do you need? Presumably the last few lines at least.

carlca commented 7 years ago

I didn't realise you could edit these messages. Debug messages now trimmed to more manageable sizes. Do you reckon you'll be able to look at this soon? I'm very keen to try out this plug-in!!

alvarolm commented 7 years ago

please post the console output of:

guru -scope ,github.com/carlca/types/nodes -tags "" callers C:\gocode\src\github.com\carlca\types\nodes\nodes.go:#1067,#1074

be aware that the guru bin should be called directly from the command "guru" and its seems that the go bin directory isnt linked properly (I dont know too much about windows), run the command above and well find out.

carlca commented 7 years ago

Syntax error - I took out the , after scope - still syntax error - complaining about #1074. Removed #1074, now guru command fails and just says "Run 'guru -help' for more information."

carlca commented 7 years ago

OK, I'm trying the same thing with a different section of code, copying and pasting (and deleting the , ) from the console to CMD (doesn't work in Powershell!). Now I get expected results. But nothing shows in ST3...

c:\gocode\src\github.com\carlca\types\nodes\nodes.go:15:16: (*github.com/carlca/types/nodes.node).AddChild is called from these 9 sites:
c:\gocode\src\github.com\carlca\types\nodes\nodes.go:75:25:     static method call from github.com/carlca/types/nodes.main
c:\gocode\src\github.com\carlca\types\nodes\nodes.go:76:25:     static method call from github.com/carlca/types/nodes.main
c:\gocode\src\github.com\carlca\types\nodes\nodes.go:77:25:     static method call from github.com/carlca/types/nodes.main
c:\gocode\src\github.com\carlca\types\nodes\nodes.go:78:24:     static method call from github.com/carlca/types/nodes.main
c:\gocode\src\github.com\carlca\types\nodes\nodes.go:79:24:     static method call from github.com/carlca/types/nodes.main
c:\gocode\src\github.com\carlca\types\nodes\nodes.go:80:24:     static method call from github.com/carlca/types/nodes.main
c:\gocode\src\github.com\carlca\types\nodes\nodes.go:81:24:     static method call from github.com/carlca/types/nodes.main
c:\gocode\src\github.com\carlca\types\nodes\nodes.go:82:24:     static method call from github.com/carlca/types/nodes.main
c:\gocode\src\github.com\carlca\types\nodes\nodes.go:83:24:     static method call from github.com/carlca/types/nodes.main

It seems that the results of the guru command are not being passed back to ST3.

IMPORTANT I forgot to mention that I only managed to get guru to produce expected results after changing the package declaration at the top of the source file from "types" back to "main".

carlca commented 7 years ago

When I had "package types" at the top of the source file, guru returned the message...

guru: analysis scope has no main and no tests
carlca commented 7 years ago

In case you're wondering about the weird line numbers in the comment above, they are correct they just reference a section of test code (not using the test package) that had a lot of repeated calls to "AddChild"!

carlca commented 7 years ago

You mentioned just now about the GOBIN directory not working. Well, I noticed that on my system, GOBIN was not being set atll as an environment variable. I have set it both to C:\Go\bin (my goroot + bin) and C:\Gocode\bin (my gopath + bin) but GoGuru didn't seem to work in either case.

carlca commented 7 years ago

I found the problem! It seems that GoGuru does not work if another package Kite (Python co-pilot software) is installed. If I disable Kite, the GoGuru works brilliantly. I especially like the "implements" command which was my primary motivation for installing the package in the first place. I'll let the Kite programmers know about the issue - I don't know whose responsibility it would be to fix it. It isn't urgent, though because the workaround (by disabling Kite) is so simple.