Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Issue #337 Remove
rerr = nil
from the defer function
Current code for handling error in the configureCluster function is wrong and return nil even there is an error because of the way we handled in the defer function. Following snip will always return the `nil` since it is assigned to `nil` at the end of defer function. ``` package main import ( "fmt" ) func getError() (rerr error) { defer func(){ err := fmt.Errorf("Error from defer") if err != nil { rerr = err } rerr = nil }() return fmt.Errorf("My error should be returned") } func main() { fmt.Println(getError()) } ```
- Loading branch information