DisposaBoy / GoSublime

A Golang plugin collection for SublimeText 3, providing code completion and other IDE-like features.
MIT License
3.42k stars 299 forks source link

call to gocode fails due to missing directory #149

Closed jamesadney closed 12 years ago

jamesadney commented 12 years ago

Autocomplete stopped working today, presumably after an update to GoSublime. Here is the traceback I got when trying to use it:

GsComplete: Error while running ['gocode', '-f=json', 'autocomplete', '<stdin>', 'c52']: GoSublime: Traceback (most recent call last):
  File "./gsshell.py", line 220, in run
  File "./gscommon.py", line 138, in popen
  File ".\subprocess.py", line 633, in __init__
  File ".\subprocess.py", line 1139, in _execute_child
OSError: [Errno 2] No such file or directory: '/home/james/.config/sublime-text-2/Packages/User/GoSublime/9'

This happens after commit 5802b1569ae4205e7eae242bbacf3cdbc902002b.

When the _gocode() function is called in mg9.py it passes gs.home_path() or $HOME/.config/sublime-text-2/Packages/User/GoSublime/9 as the current working directory. This path didn't exist on my system so subprocess.Popen threw the exception.

After creating an empty folder at $HOME/.config/sublime-text-2/Packages/User/GoSublime/9 autocomplete started working again.

metaleap commented 12 years ago

Similar problem since the last auto-update today, console shows this:

** 2012-11-04 15:15:42.547000 **:
GsComplete: Error while running ['gocode', '-f=json', 'autocomplete', 'C:\\gd\\src\\test\\main.go', 'c209']: GoSublime: Traceback (most recent call last):
  File ".\gsshell.py", line 220, in run
  File ".\gscommon.py", line 138, in popen
  File ".\subprocess.py", line 633, in __init__
  File ".\subprocess.py", line 842, in _execute_child
WindowsError: [Error 267] The directory name is invalid
--------------------------------

Also can confirm that creating an empty directory C:\Users\roxor\AppData\Roaming\Sublime Text 2\Packages\User\GoSublime\9 temporarily resolves the issue.

DisposaBoy commented 12 years ago

thanks for the report, the last commit edfdd1fcde824e77804fcaf92ba0f1d1cae37f59 should fix it

jamesadney commented 12 years ago

After updating the folder is created when missing without user intervention. Thanks for the quick fix.