cmd/revid-cli: input file is closed before we can read it

Issue #50 resolved
Saxon Milton created an issue

if we do file output, we are getting an error indicating that the file has been closed when we're trying to read from it. This is because in setupInputForFile we do a defer on f.Close() but before the return we run lexTo as a routine which requires the file.

I propose that we have revid possess a File type and close in revid.Stop().

Comments (2)

  1. kortschak

    I don't think a file type is needed. There are two options, having an interface input that's the cognate of the loadSenders or have the startup routines return a closure, func() error, that handles resource freeing (in this case closing the file).

  2. Log in to comment