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

GoImport broken when adding to empty imports. #1534

Closed
icholy opened this issue Oct 24, 2017 · 5 comments · Fixed by #1938
Closed

GoImport broken when adding to empty imports. #1534

icholy opened this issue Oct 24, 2017 · 5 comments · Fixed by #1938
Assignees
Labels

Comments

@icholy
Copy link

icholy commented Oct 24, 2017

What did you do?

package main

import ()

Execute: :GoImport time

What did you expect to happen?

package main

import (
	"time"
)

What happened instead?

package main

import ()
	"time"

Configuration

  • vim version: 8.0 Included patches: 1-1207
  • vim-go version: 0878992 (HEAD)
  • go version (go version): 1.9
  • operating system: Ubuntu 16.04
  • vimrc you used to reproduce:
set nocompatible

" Plugins
call plug#begin('~/.vim/plugged')

Plug 'fatih/vim-go'

call plug#end()
@bhcleek
Copy link
Collaborator

bhcleek commented Oct 24, 2017

Thank you for taking the time to report this. It looks to be a bug in goimports, though.

@bhcleek bhcleek closed this as completed Oct 24, 2017
@icholy
Copy link
Author

icholy commented Oct 24, 2017

@bhcleek :GoImport doesn't use goimports

@bhcleek
Copy link
Collaborator

bhcleek commented Oct 24, 2017

You're right, of course.

@fatih
Copy link
Owner

fatih commented Sep 2, 2018

This is a very rare use case in my opinion. Not sure why one would want to write an empty import statement and then later import something? Or do I miss something here?

I know it's not related, but tools like goimports even don't allow to save it in this format, they remove the empty import () statement automatically.

@fatih
Copy link
Owner

fatih commented Sep 2, 2018

This if fixed now in master, will be part of the upcoming release.

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

Successfully merging a pull request may close this issue.

4 participants