Get rid of err altogether by just returning the assignment

Signed-off-by: Xianglin Gao <xlgao@zju.edu.cn>
This commit is contained in:
Xianglin Gao 2016-12-13 14:25:57 +08:00
parent e9076c0f00
commit da5d3cccc4
2 changed files with 3 additions and 10 deletions

View file

@ -39,7 +39,7 @@ func cmd(dir string, arg ...string) (string, error) {
output, err := c.CombinedOutput()
if err != nil {
return "", fmt.Errorf("running `%s %s` failed with output: %s\nerror: %v", c.Path, strings.Join(c.Args, " "), string(output), err)
return "", fmt.Errorf("running `%s %s` failed with output: %s\nerror: %v", c.Path, strings.Join(c.Args, " "), output, err)
}
return string(output), nil

View file

@ -54,10 +54,7 @@ func (p *profileData) generateDefault(out io.Writer) error {
}
p.Version = ver
if err := compiled.Execute(out, p); err != nil {
return err
}
return nil
return compiled.Execute(out, p)
}
// macrosExists checks if the passed macro exists.
@ -87,11 +84,7 @@ func InstallDefault(name string) error {
return err
}
if err := aaparser.LoadProfile(profilePath); err != nil {
return err
}
return nil
return aaparser.LoadProfile(profilePath)
}
// IsLoaded checks if a profile with the given name has been loaded into the