Coder Social home page Coder Social logo

Comments (24)

fatih avatar fatih commented on May 18, 2024

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

from vim-go.

bkaradzic avatar bkaradzic commented on May 18, 2024

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

from vim-go.

fatih avatar fatih commented on May 18, 2024

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.

from vim-go.

bkaradzic avatar bkaradzic commented on May 18, 2024

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

from vim-go.

fatih avatar fatih commented on May 18, 2024

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

from vim-go.

bkaradzic avatar bkaradzic commented on May 18, 2024

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

from vim-go.

fatih avatar fatih commented on May 18, 2024

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

from vim-go.

bkaradzic avatar bkaradzic commented on May 18, 2024

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.

from vim-go.

bkaradzic avatar bkaradzic commented on May 18, 2024

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

from vim-go.

fatih avatar fatih commented on May 18, 2024

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

from vim-go.

fatih avatar fatih commented on May 18, 2024

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}}'

from vim-go.

bkaradzic avatar bkaradzic commented on May 18, 2024

: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/).

from vim-go.

fatih avatar fatih commented on May 18, 2024

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

from vim-go.

bkaradzic avatar bkaradzic commented on May 18, 2024

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?

from vim-go.

fatih avatar fatih commented on May 18, 2024

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

from vim-go.

bkaradzic avatar bkaradzic commented on May 18, 2024

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}}'

from vim-go.

bkaradzic avatar bkaradzic commented on May 18, 2024

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

from vim-go.

fatih avatar fatih commented on May 18, 2024

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'

from vim-go.

weitzj avatar weitzj commented on May 18, 2024

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.

from vim-go.

bkaradzic avatar bkaradzic commented on May 18, 2024

@weitzj 👍

from vim-go.

TomTom86 avatar TomTom86 commented on May 18, 2024

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...

from vim-go.

markwest1 avatar markwest1 commented on May 18, 2024

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

from vim-go.

philwhln avatar philwhln commented on May 18, 2024

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

from vim-go.

nishanths avatar nishanths commented on May 18, 2024

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

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

from vim-go.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.