Browse code

Get rid of err altogether by just returning the assignment

Signed-off-by: Xianglin Gao <xlgao@zju.edu.cn>

Xianglin Gao authored on 2016/12/13 15:25:57
Showing 2 changed files
... ...
@@ -39,7 +39,7 @@ func cmd(dir string, arg ...string) (string, error) {
39 39
 
40 40
 	output, err := c.CombinedOutput()
41 41
 	if err != nil {
42
-		return "", fmt.Errorf("running `%s %s` failed with output: %s\nerror: %v", c.Path, strings.Join(c.Args, " "), string(output), err)
42
+		return "", fmt.Errorf("running `%s %s` failed with output: %s\nerror: %v", c.Path, strings.Join(c.Args, " "), output, err)
43 43
 	}
44 44
 
45 45
 	return string(output), nil
... ...
@@ -54,10 +54,7 @@ func (p *profileData) generateDefault(out io.Writer) error {
54 54
 	}
55 55
 	p.Version = ver
56 56
 
57
-	if err := compiled.Execute(out, p); err != nil {
58
-		return err
59
-	}
60
-	return nil
57
+	return compiled.Execute(out, p)
61 58
 }
62 59
 
63 60
 // macrosExists checks if the passed macro exists.
... ...
@@ -87,11 +84,7 @@ func InstallDefault(name string) error {
87 87
 		return err
88 88
 	}
89 89
 
90
-	if err := aaparser.LoadProfile(profilePath); err != nil {
91
-		return err
92
-	}
93
-
94
-	return nil
90
+	return aaparser.LoadProfile(profilePath)
95 91
 }
96 92
 
97 93
 // IsLoaded checks if a profile with the given name has been loaded into the