You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mynewt.apache.org by GitBox <gi...@apache.org> on 2020/01/28 16:59:49 UTC

[GitHub] [mynewt-newt] ccollins476ad commented on a change in pull request #373: Fix some issues reported by Coverity

ccollins476ad commented on a change in pull request #373: Fix some issues reported by Coverity
URL: https://github.com/apache/mynewt-newt/pull/373#discussion_r371932356
 
 

 ##########
 File path: newt/toolchain/compiler.go
 ##########
 @@ -1374,7 +1373,7 @@ func (c *Compiler) CopySymbols(infile string, outfile string, sm *symbol.SymbolM
 	if err != nil {
 		return err
 	}
-	return err
+	return nil
 
 Review comment:
   @utzig You are right - there was no actual bug here.  Unfortunately I cannot post the actual Coverity scan results since they come from a private version of the analyzer, but the description of the issue is:
   > Identical code for different branches
   
   So even though there is no bug, I agree with Coverity that the code did not look right.  I think there are two ways to fix this:
   1. Remove the `if err != nil` entirely.  Keep the `return err`.
   2. Do what I did (change `return err` to `return nil`).
   
   I prefer option 2 because it is more "Go-like" consistent with the rest of the code.  Also, I think it improves maintainability because it makes it easy to add more code before the `return nil`.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services