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

Append Go file type when creating temporary file #1601

Merged
merged 2 commits into from
Dec 10, 2017

Conversation

mocheryl
Copy link
Contributor

@mocheryl mocheryl commented Dec 6, 2017

A lot of scripts filter files based on their name to make sure they
operate only on the appropriate content. By appending a Go file type to
a temporary file when running a formatter, we add support for a broader
range of Go formating tools.

Fixes #208

@arp242
Copy link
Contributor

arp242 commented Dec 6, 2017

Thanks! I think this should be fine, but would be good to test on Windows, too. Just to be sure.

I don't think that any of the regular Go maintainers use Windows – I don't have a Windows machine anyway – but I'll look at running the tests on AppVeyor too, so we can test it in the CI.

@mocheryl
Copy link
Contributor Author

mocheryl commented Dec 7, 2017

I don't have a Windows machine anyway

Neither do I (tried on Linux using neovim), but if there's no other way, I'll see if I can procure one from somewhere.

If it doesn't work, then another way would be to pipe the buffer content to standard input of the formatter, but that would require be a bit more code change.

@arp242
Copy link
Contributor

arp242 commented Dec 7, 2017

Well, I acquired a Windows VM from modern.ie. Setting up AppVeyor is going to be a lot more work than I thought.

I'll test tomorrow. It was mentioned in another PR a while ago that tempname() behaves quite different on Windows than it does on Linux/macOS, which is why it would be good to test this PR on Windows.

mocheryl and others added 2 commits December 10, 2017 01:05
A lot of scripts filter files based on their name to make sure they
operate only on the appropriate content. By appending a Go file type to
a temporary file when running a formatter, we add support for a broader
range of Go formating tools.

Fixes fatih#208
@arp242
Copy link
Contributor

arp242 commented Dec 10, 2017

On Windows it returns a path like C:\Users\IEUser\AppData\Local\Temp\VIC99BD.tmp; this patch seems to work well. Thanks! 👍

@codecov-io
Copy link

Codecov Report

❗ No coverage uploaded for pull request base (master@7904a27). Click here to learn what that means.
The diff coverage is 100%.

Impacted file tree graph

@@            Coverage Diff            @@
##             master    #1601   +/-   ##
=========================================
  Coverage          ?   14.78%           
=========================================
  Files             ?       53           
  Lines             ?     4152           
  Branches          ?        0           
=========================================
  Hits              ?      614           
  Misses            ?     3538           
  Partials          ?        0
Flag Coverage Δ
#nvim 5.05% <0%> (?)
#vim74 14.71% <100%> (?)
#vim80 14.47% <100%> (?)
Impacted Files Coverage Δ
autoload/go/fmt.vim 63.63% <100%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 7904a27...be012ab. Read the comment docs.

@arp242 arp242 merged commit 2a42722 into fatih:master Dec 10, 2017
@mocheryl mocheryl deleted the append-file-type branch December 10, 2017 18:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants