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 detected while processing function GoFiles #30

Closed
bkaradzic opened this issue Mar 31, 2014 · 24 comments
Closed

error detected while processing function GoFiles #30

bkaradzic opened this issue Mar 31, 2014 · 24 comments
Labels

Comments

@bkaradzic
Copy link

Just installed vim-go (on windows) and getting errors when opening .go files:

E484: Can't open file <path>\AppData\Local\Temp\VIo5EB7.tmp

.vim-go dir has: errcheck, golint, oracle, godef, goimports, gocode and installation didn't have any errors.

@fatih
Copy link
Owner

fatih commented Mar 31, 2014

Can you past the full log? Usually the file is listed too.

@fatih fatih added the bug label Mar 31, 2014
@bkaradzic
Copy link
Author

The same issue on OSX (2 errors before opening .go file):

Error detected while processing function GoFiles: line 1: E484: Can't open file /var/folders/2y/xnkn1mdn18j87g40pqc_b3qc0000gn/T/vbAj3PD/0 Press ENTER or type command to continue Error detected while processing function GoFiles: line 1: E484: Can't open file /var/folders/2y/xnkn1mdn18j87g40pqc_b3qc0000gn/T/vbAj3PD/1 Press ENTER or type command to continue

@fatih
Copy link
Owner

fatih commented Apr 1, 2014

GoFiles() is using go list to obtain the dependencies of the file in your current directory. Do you work on a directory that isn't accessible ? Also can you try to invoki :GoFiles and paste the results there.

@bkaradzic
Copy link
Author

Typing :GoFiles produces the same result as above... Empty line, and then can't open file in temp dir.

I'm using FuzzyFinder with VIM, and go list in current directory produces:
$ go list can't load package: package .: no buildable Go source files in ...

I usually open vim in GOPATH dir which doesn't contain any .go files anyway.

Here is my VIM setup: https://github.com/bkaradzic/dotvim

@fatih
Copy link
Owner

fatih commented Apr 1, 2014

Yeah it needs go files. If there is no go files available it does produce an output like this.

@bkaradzic
Copy link
Author

GoFiles does it even if I open vim in dir with .go files.

@fatih
Copy link
Owner

fatih commented Apr 1, 2014

Can you give me your test files please? I need a way to reproduce it :( Is your GOPATH not set maybe ?

@bkaradzic
Copy link
Author

I just tried on this, and even when there are .go files it doesn't work: https://github.com/bkaradzic/go-lz4
GOPATH is set.

@bkaradzic
Copy link
Author

Btw, I tried this on Windows, Linux and OSX and I get the same behavior everywhere.

@fatih
Copy link
Owner

fatih commented Apr 1, 2014

Thanks @bkaradzic , I'm looking at it now.

@fatih
Copy link
Owner

fatih commented Apr 1, 2014

Just tested it with your package (on Mac OS X) and this is what I have:

screen shot 2014-04-01 at 11 54 53 pm

I have two questions:

  1. I think :GoFiles is not executed in the files folder. Can you give me the output of :pwd before you do a :GoFiles ?
  2. Can you simply execute this in your folder from Terminal?:
go list -f $'{{range $f := .GoFiles}}{{$.Dir}}/{{$f}}\n{{end}}'

@bkaradzic
Copy link
Author

:pwd returns just current directory which is go-lz4...

But the problem might be that I'm not using bash... On Win I just use standard cmd, on OSX and Linux I'm using fish shell (http://fishshell.com/).

@fatih
Copy link
Owner

fatih commented Apr 1, 2014

Is escaping different in fish shell? How would the command above work for you ?

@bkaradzic
Copy link
Author

Fish is not really backwards compatible. I just changed back to bash (chsh -s ) restarted terminal and now :GoFiles works. Is it possible to add option to specify bash executable path?

@fatih
Copy link
Owner

fatih commented Apr 1, 2014

We can give a specific shell option to system() call in vimscript. That would do the trick.

@bkaradzic
Copy link
Author

Just pasting this as info. But probably you don't want to support all shell variations:
ish: Did you mean (COMMAND)? In fish, the '$' character is only used for accessing variables. To learn more about command substitution in fish, type 'help expand-command-substitution'. go list -f $'{{range $f := .GoFiles}}{{$.Dir}}/{{$f}}\n{{end}}'

@bkaradzic
Copy link
Author

Cool! This probably would fix Windows too, since I can use bash from msys there.

@fatih
Copy link
Owner

fatih commented Apr 2, 2014

https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=609599 fixes your problem. Seems you need to apply:

if $SHELL =~ 'fish'
  set shell='/bin/sh'
endif

or

set shell='/bin/sh'

@weitzj
Copy link

weitzj commented May 3, 2014

See also: https://github.com/dag/vim-fish

Vim needs a more POSIX compatible shell than fish for certain functionality to work, such as :%!, compressed help pages and many third-party addons. If you use fish as your login shell or launch Vim from fish, you need to set shell to something else in your ~/.vimrc, for example:

if &shell =~# 'fish$'
    set shell=sh
endif

Best do it somewhere at the top, before any addon code is loaded and executed.

Note that this also affects what :sh[ell] launches, so if you care about that you might want to set it to your second best shell instead. If you use Vim in the terminal you could also train yourself to use :st[op] or CTRL-Z instead and then fg in fish to get back to Vim.

@bkaradzic
Copy link
Author

@weitzj 👍

@TomTom86
Copy link

TomTom86 commented Jul 9, 2015

Hi all, i have the some problem:

when i try :GoRun or others GoCommand i have this error

image

My os is Win7, i use gvim7.4 and in my _vimrc i set:

set shell=cmd
set shellcmdflag=/c

i try :echo system("echo hi") and the error is the some:

image

i can't understand what i wrong...

@markwest1
Copy link

This file opening error occurs when gvim is invoked from bash within MINGW64 terminal, but not when it is invoked from Windows explorer or bash within cmd.exe.

Error when invoked from MINGW64 terminal window:
image

No error when invoked from bash within cmd.exe:
image

Log:
image

@philwhln
Copy link

philwhln commented Nov 9, 2015

I have this set up in .vimrc

if $SHELL =~ 'fish'
  set shell='/bin/sh'
endif

but still hitting issues when trying to save a file

Cannot execute shell '/bin/sh'
Error detected while processing function go#fmt#Format:
line   44:
E484: Can't open file /var/folders/pf/01012ncd26d4rcz5qknsym940000gn/T/vCqzcXR/7

@nishanths
Copy link

@philwhln Uninstalling and reinstalling vim-go fixed this for me.

I'd love to know if you found the real cause of the issue.

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

No branches or pull requests

7 participants