barum / gomock

Automatically exported from code.google.com/p/gomock
Apache License 2.0
0 stars 0 forks source link

Output file created even on error #6

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
run mockgen --source=temp.go --aux_files=flag=/invalid/path/here 
--destination=mock_temp.go

What is the expected output? What do you see instead?
Expected output is an error and no file created. Instead, a file is created.

Original issue reported on code.google.com by awre...@gmail.com on 11 Oct 2011 at 6:48

Attachments:

GoogleCodeExporter commented 9 years ago
This would require significant restructuring of mockgen, and it's usually far 
more useful to get the partial output for debugging purposes.

Original comment by dsymo...@golang.org on 11 Oct 2011 at 10:43

GoogleCodeExporter commented 9 years ago
I just found that this make it really difficult to write a make rule that
used mockgen, as subsequent calls to make would check the timestamp of the
incomplete file and asssume it was up to date.

Original comment by awre...@gmail.com on 11 Oct 2011 at 2:20

GoogleCodeExporter commented 9 years ago
Doesn't it work to do something like this?

  mock_%.go : %.go
    mockgen ... || rm $@

Original comment by dsymo...@golang.org on 12 Oct 2011 at 1:48

GoogleCodeExporter commented 9 years ago
Yes, but you would want to add `rm -f $@` for case when the file wasn't
actually created.

Original comment by awre...@gmail.com on 12 Oct 2011 at 1:57