Skip to content

go#template#create error when using vim-fugitive :Gdiff #1399

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

Closed
myitcv opened this issue Aug 4, 2017 · 7 comments
Closed

go#template#create error when using vim-fugitive :Gdiff #1399

myitcv opened this issue Aug 4, 2017 · 7 comments

Comments

@myitcv
Copy link

myitcv commented Aug 4, 2017

Behavior

See below.

Steps to reproduce:

  1. Open a .go file in a git controlled repo
  2. Run :Gdiff to view the differences in that file between working tree and staged version
  3. See the following error:
Error detected while processing function <SNR>45_template_autocreate[3]..go#template#create:
line    6:
E472: Command failed

and the side-by-side diff fails to show.

Instead we should see the normal :Gdiff output.

This error goes away if g:go_template_autocreate = 0 (but then so does the templating of new .go files)

Configuration

As above.

@arp242
Copy link
Contributor

arp242 commented Aug 6, 2017

I can't seem to reproduce this; I am using a default Neovim installation (0.2.0, not the latest beta) with just those two plugins in ~/.local/share/nvim/site/pack/plugins/start/ and no further configuration. :Gdiff works as expected.

Maybe it's a problem with some specific configuration?

@arp242
Copy link
Contributor

arp242 commented Sep 6, 2017

I'll close this for now due to lack of feedback. Feel free to comment if you have further problems or questions and we can reopen this issue.

@arp242 arp242 closed this as completed Sep 6, 2017
@myitcv
Copy link
Author

myitcv commented Sep 13, 2017

@Carpetsmoker - apologies, yes I didn't get a chance to dig into this any further.

If it raises its head again I'll certainly dig deeper.

Thanks

@nathanmalishev
Copy link

Hey there, I seem to experience a similar issue with vim-fugitive & vim-go.
Probably a simple noob error but worth asking.
The plugin works great on all accounts, except for when I :Gdiff, with vim-fugitive i receive a similar error.
Possibly because vim-fugitive, does something with the file path, placing it under fugitive:///?

go env GOROOT fails - Works literally every place i can find to run the command, terminal, tmux, vim etc

image

@bhcleek
Copy link
Collaborator

bhcleek commented Oct 16, 2017

@nathanmalishev I've seen similar issues, but haven't dug into a root cause yet.

In your case, it looks like you may have g:go_auto_sameids=1. If that's the case, then you can work around this issue by calling :GoSameIdsAutoToggle to turn off g:go_auto_sameids when you have a fugitive window open.

@nathanmalishev
Copy link

@bhcleek thanks for the quick response. That seems to be the work around!

@vedharish
Copy link

vedharish commented Oct 20, 2017

@Carpetsmoker I can reproduce this as well..
Required -

  1. git repo must be initialised for the file
  2. the file currently being edited must be UNTRACKED in git

Point 2. makes sense because the :Gdiff command compares an empty buffer (filetype=go) with the whole file and vim-go tries to template_autocreate on the empty buffer

:Gdiff works fine for me on all git tracked files

No idea if PR #1516 will fix this as there are no changes to template_autocreate function. So just went ahead and commented this

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

No branches or pull requests

5 participants