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

Question: Weird behavior with newly created go project files #1715

Closed
stefanos82 opened this issue Mar 11, 2018 · 4 comments
Closed

Question: Weird behavior with newly created go project files #1715

stefanos82 opened this issue Mar 11, 2018 · 4 comments
Labels

Comments

@stefanos82
Copy link

stefanos82 commented Mar 11, 2018

I use the latest version of vim-go from github using Vim 8.0 under Debian testing 64-bit.

vim-go gives the user the opportunity to open a new main.go file in the form of a skeleton.

What I usually do when I want to build a new project from scratch is to open a nonexistent folder combined with main.go and inside Vim I run a standard command :!mkdir -p %:h to create my folder and then save my file so I can start working on my project.

Immediately after I press my Enter key to return back to Vim from my terminal output, I press :w to write on the newly created file that is located in the newly created folder.

With vim-go I get the following behavior though:

"foo/main.go" E212: Can't open file for writing

As soon as I close Vim and reopen it from the newly created folder with the main.go and press the :w command, now it writes it to the aforementioned location.

Should this behavior be considered a bug or no?

Please advice, thank you.

@bhcleek
Copy link
Collaborator

bhcleek commented Mar 11, 2018

Yes, this should be considered a bug.

@bhcleek bhcleek added the bug label Mar 11, 2018
@arp242
Copy link
Contributor

arp242 commented Apr 8, 2018

This seems to work well for me. I actually fixed this before in #1618.

@stefanos82
Copy link
Author

@Carpetsmoker The issue remains for me even with the latest updates.

@bhcleek
Copy link
Collaborator

bhcleek commented Apr 8, 2018

#1618 doesn't solve this problem for me as described by @ stefanos82. All that #1618 does is to make sure the package name is determined correctly.

Calling vim notadir/quux.go and immediately running :w displays the message Can't open file for writing. The same message is shown when the file in a non-existent directory is created by opening it with :e notadir/quux.go from within vim. This is an issue with Vim, though, not with vim-go....

However, calling vim notadir/quux.go and immediately running :!mkdir notadir followed by :w displays the message Autcommands deleted or unloaded buffer to be written.

You can see this result pretty easily with our docker container:

docker run --rm -i -t --entrypoint /tmp/vim-go-test/vim-8.0-install/bin/vim vim-go-test -N +"set packpath=/tmp/vim-go-test/vim-8.0-install/share/vim/vimgo" +"filetype plugin indent on" +'packloadall!' +'e notadir/quux.go' +'!mkdir notadir' +'w'

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

3 participants