Closed ghost closed 8 years ago
Thanks for PR! I'll merge it, but I have one question: why did you move file closings from defer to the end of the function?
I think the cause may be to avoid the rename of open files. A test-case to demontrate the issue (and be able to try on windows) would be nice.
@mro exactly. @forgiv also commented it in source file. Ok, I merge it.
maybe keeping the defer
would still be nice? https://github.com/mro/id3v2/commit/22f4e86ddd9a6bbac1d1fabaa32d54798bf8da98
The diff mostly is due to indentlevel+=1
@mro but it looks ugly :(
@bogem lol, the diff indeed looks horrible due to the increased indentation and lots of whitespace diff. But the result (anon func) is quite nice, don't you think?
https://github.com/mro/id3v2/blob/22f4e86ddd9a6bbac1d1fabaa32d54798bf8da98/tag.go#L232
Edit: I'm not sure my code is correct, so be careful in case. Variables, e.g. originalFile
, being assigned inside the closure …)
uh, what a garbage. Sorry for the confusion.
@mro Sorry, but I mean the anonymous function looks ugly. It shouldn't be implemented in this way.
Also newFile
and originalFile
are assigned in this anon function, but they are used outside of this function.
Changed a couple lines in tag.go that are not compatible with windows to be more cross-compatible. Tested on Windows 10 and Ubuntu 16.04