The analyzer has detected a variable whose value was overwritten before it was used.
The example:
func createUser(req *http.Request) error {
user, err := parseUser(req)
if err != nil {
return err
}
err = validateUser(user)
err = saveUser(user)
return err
}
The return value of the validateUser function is assigned to the err variable. On the next line, a new value is assigned to the same variable. This means that the result of validateUser was not handled.
To fix this, add a check for the err variable immediately after assigning it the return value of validateUser:
func createUser(req *http.Request) error {
user, err := parseUser(req)
if err != nil {
return err
}
err = validateUser(user)
if err != nil {
return err
}
err = saveUser(user)
return err
}
Was this page helpful?
Your message has been sent. We will email you at
If you do not see the email in your inbox, please check if it is filtered to one of the following folders: