-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
fileformat changed by GoFmt #595
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
Comments
I think it changed by |
I think you're correct. The commit I referenced above introduced the use of gofmt's -w option, which modifies the source file externally. Since gofmt changes all the line endings to lf, when the current buffer is reloaded it detects the fileformat as unix. I submitted a pull-request which fixes this issue: #615 |
Fix issue #595 - fileformat changed by gofmt
The pull-request was merged in, fixing the issue. This issue can be closed. |
I am running gvim on windows 7. When I open a new .go file, I can run the following vim command in order to check the file format:
:set ff?
The result is:
fileformat=dos
, which I was I expect, and what I want.If I then run the GoFmt command, like so:
:GoFmt
And again check the fileformat, it now returns
fileformat=unix
, which is undesirable. Furthermore, all of my line endings have changed from crlf to lf, which I do not want (git keeps complaining to me about it).If I run
:verbose set ff?
, it tells me that the fileformat wasLast set from ~\vimfiles\bundle\vim-go\autoload\go\fmt.go
If I revert that file (fmt.go) to a version prior to this commit: 01578fd the problem does not occur. Hence, I believe that the problem was introduced in that commit.
I should also note that I am using goimports for my GoFmt command, as established by this line in my vimrc:
let g:go_fmt_command = "goimports"
The text was updated successfully, but these errors were encountered: