Closed samcoe closed 1 year ago
@mislav I think the CodeQL warnings are not exactly around having an unhandled error and more that since we are writing to these files the data might be cached until the file handle is closed, so the errors that happen here are most likely to be errors writing that cached data to the file which feel more important than just a standard file closing error. We do normal expose write errors to the user as they indicate a potential lose of data.
Note there are other use cases of defer f.Close()
that I didn't fix up because the file is only being read from and not written to.
Addresses two CodeQL warnings about properly handling the return value when closing a file that has been written to.
Fixes https://github.com/cli/go-gh/security/code-scanning/13 Fixes https://github.com/cli/go-gh/security/code-scanning/14