This is an automated email from the ASF dual-hosted git repository. ccollins pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/mynewt-newt.git
commit cf66769bc901e79c93ea2bc88e822f76f0f9577f Author: Christopher Collins <[email protected]> AuthorDate: Mon Jan 27 10:56:22 2020 -0800 toolchain: Check for error when deleting .a file The code was checking the `err` variable without assigning it. As a result, it was checking for an error from a prior operation (which was already being checked). --- newt/toolchain/compiler.go | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/newt/toolchain/compiler.go b/newt/toolchain/compiler.go index a1851e5..05dc424 100644 --- a/newt/toolchain/compiler.go +++ b/newt/toolchain/compiler.go @@ -1246,15 +1246,14 @@ func (c *Compiler) CompileArchive(archiveFile string) error { return nil } - // Delete the old archive, if it exists. - os.Remove(archiveFile) - util.StatusMessage(util.VERBOSITY_DEFAULT, "Archiving %s", path.Base(archiveFile)) util.StatusMessage(util.VERBOSITY_VERBOSE, " with object files %s", strings.Join(objList, " ")) util.StatusMessage(util.VERBOSITY_DEFAULT, "\n") + // Delete the old archive, if it exists. + err = os.Remove(archiveFile) if err != nil && !os.IsNotExist(err) { return util.NewNewtError(err.Error()) }
