Open jdhenke opened 5 years ago
This is an issue that's somewhat known. The difficulty here is that conjure-go
doesn't store state, so knowing that an existing file "should be deleted" isn't trivial.
The location of the output files (like aliases.conjure.go
) is determined by the package path relative to the output directory. If a file in a particular package is no longer generated, then conjure-go
doesn't know to look for the file.
The only approach I can think of is a process like the following:
When running the generation task:
*.conjure.go
files that exist*.conjure.go
files that are generated by the task*.conjure.go
files that were found but not generated by the task)*.conjure.go
files caused any directories to become empty based on that action, delete the directory, and do this recursivelyPossible issues:
/
)
These possibles issues are probably much rarer than the common scenario outlined in this issue, so not opposed to implementing the fix. However, I think we may want to add a flag that allows this behavior to be disabled as well.
What happened?
If you have aliases in your conjure definition and generated go code, then remove all aliases and regenerate the go code into the same directory, the old
aliases.conjure.go
file and alias definitions still exist when they should not.What did you want to happen?
conjure-go
should delete thealiases.conjure.go
if there are no aliases.NOTE: This may apply to other files that
conjure-go
writes as well.