Skip to content

Commit 6c39369

Browse files
committed
git-sizer.go: handle some more errors
1 parent 4740a65 commit 6c39369

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed

git-sizer.go

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,9 @@ func mainImplementation(args []string) error {
164164
flags.Lookup("no-progress").NoOptDefVal = "true"
165165

166166
flags.StringVar(&cpuprofile, "cpuprofile", "", "write cpu profile to file")
167-
flags.MarkHidden("cpuprofile")
167+
if err := flags.MarkHidden("cpuprofile"); err != nil {
168+
return fmt.Errorf("marking option hidden: %w", err)
169+
}
168170

169171
var configger refopts.Configger
170172
if repo != nil {
@@ -193,7 +195,9 @@ func mainImplementation(args []string) error {
193195
if err != nil {
194196
return fmt.Errorf("couldn't set up cpuprofile file: %w", err)
195197
}
196-
pprof.StartCPUProfile(f)
198+
if err := pprof.StartCPUProfile(f); err != nil {
199+
return fmt.Errorf("starting CPU profiling: %w", err)
200+
}
197201
defer pprof.StopCPUProfile()
198202
}
199203

@@ -289,10 +293,12 @@ func mainImplementation(args []string) error {
289293
}
290294
fmt.Printf("%s\n", j)
291295
} else {
292-
io.WriteString(
296+
if _, err := io.WriteString(
293297
os.Stdout,
294298
historySize.TableString(rg.Groups(), threshold, nameStyle),
295-
)
299+
); err != nil {
300+
return fmt.Errorf("writing output: %w", err)
301+
}
296302
}
297303

298304
return nil

0 commit comments

Comments
 (0)