Closed sorinescu closed 4 years ago
Merging #6 into master will decrease coverage by
2.30%
. The diff coverage is0.00%
.
@@ Coverage Diff @@
## master #6 +/- ##
==========================================
- Coverage 67.37% 65.06% -2.31%
==========================================
Files 1 1
Lines 282 292 +10
==========================================
Hits 190 190
- Misses 73 83 +10
Partials 19 19
Impacted Files | Coverage Δ | |
---|---|---|
main.go | 65.06% <0.00%> (-2.31%) |
:arrow_down: |
I've found the following bug with Go 1.13 and earlier (the code works fine with Go 1.14):
I want to generate a DeepCopy method on my type in a file inside my package, with a command like
deep-copy -o generated_mytype_deepcopy.go -type MyType -pointer-receiver my/package
. This works fine.I then call
DeepCopy
from a piece of code withinmy/package
.However, if I make changes to my type and I want to regenerate the file, it will fail because the tool first truncates the output file, then it tries to load
my/package
, which will now fail for two reasons:package ...
DeepCopy
can no longer be compiled because the method is gone.This PR postpones opening the output file until it actually has to write to it, but it still checks that the file can be written without opening it.