Skip to content

Commit a51b6ec

Browse files
author
Katrina Owen
authored
Merge pull request #873 from avegner/add-missing-error-checks
Make all errors in cmd package checked
2 parents 4ad01b1 + 96a994c commit a51b6ec

File tree

3 files changed

+7
-4
lines changed

3 files changed

+7
-4
lines changed

cmd/download.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,9 @@ func runDownload(cfg config.Config, flags *pflag.FlagSet, args []string) error {
104104
// TODO: handle collisions
105105
path := sf.relativePath()
106106
dir := filepath.Join(metadata.Dir, filepath.Dir(path))
107-
os.MkdirAll(dir, os.FileMode(0755))
107+
if err = os.MkdirAll(dir, os.FileMode(0755)); err != nil {
108+
return err
109+
}
108110

109111
f, err := os.Create(filepath.Join(metadata.Dir, path))
110112
if err != nil {

cmd/open.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,7 @@ Pass the path to the directory that contains the solution you want to see on the
2121
if err != nil {
2222
return err
2323
}
24-
browser.Open(metadata.URL)
25-
return nil
24+
return browser.Open(metadata.URL)
2625
},
2726
}
2827

cmd/troubleshoot.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,9 @@ func (status *Status) compile() (string, error) {
124124
}
125125

126126
var bb bytes.Buffer
127-
t.Execute(&bb, status)
127+
if err = t.Execute(&bb, status); err != nil {
128+
return "", err
129+
}
128130
return bb.String(), nil
129131
}
130132

0 commit comments

Comments
 (0)