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

Error executing :GoDef with tcsh #868

Closed
tsne opened this issue May 21, 2016 · 2 comments
Closed

Error executing :GoDef with tcsh #868

tsne opened this issue May 21, 2016 · 2 comments

Comments

@tsne
Copy link
Contributor

tsne commented May 21, 2016

Actual behavior

I'm using tcsh as my default shell and every time I execute :GoDef, I get the following error:

Error detected while processing function go#def#Jump[18]..go#util#System:
E484: Can't open file /var/folders/gy/y60619bd0t95zcxs326y1f8r0000gn/T/vufGvHW/0

Expected behavior

I would expect that the cursor jumps to the definition of the method or type.

Steps to reproduce:

Create a short program with a simple function and a call to this function, e.g.

package main

func main() {
    foo()
}

func foo() {}

Set the shell to tcsh (:set shell='/bin/tcsh'), navigate the cursor to the call of foo in the main function and execute :GoDef.

Configuration

  • vim version: 7.4
  • vim-go version: current master
  • go version: 1.6.2

Problem

The function go#def#Jump builds the command with the use of shellescape. So the filename is surrounded by single quotation marks and the executed system call looks like

guru  definition 'foo.go':#123

which seems to produce the error. If the system call would look like

guru  definition 'foo.go:#123'

it should run with all major shells (including tcsh).

Possible Solution

I would suggest building the command in the go#def#Jump function with

printf("%s %s definition %s", bin_path, flags, shellescape(fname.':#'.go#util#OffsetCursor()))

instead. Or do I miss any edge cases?

@fatih fatih closed this as completed in 92632a0 May 21, 2016
@fatih
Copy link
Owner

fatih commented May 21, 2016

Hi @tsne

Thanks for your feedback. Vim needs a POSIX compatible shell actually. I'm not sure if that is true for your case, but check out these instructions as well: https://github.com/fatih/vim-go/wiki/FAQ-Troubleshooting#im-using-fish-shell-but-have-some-problems-using-vim-go

According to your solution, that would be an improvement probably. I've pushed it to master as well, let me know if there is any problem with it.

@tsne
Copy link
Contributor Author

tsne commented May 21, 2016

Hi @fatih

thank you very much for pushing the change to the master. I played a little bit with :GoDef and it seems to work now.

Actually I would like to avoid switching the shell for Vim. All the features I use are working so far. If there are any major problems in the future which are not fixable that easily, maybe I will consider configuring another shell. Thanks for the information.

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

2 participants