Skip to content

Commit 4d58baa

Browse files
committed
fix: more "ignored" errors
1 parent 91123c0 commit 4d58baa

3 files changed

Lines changed: 10 additions & 6 deletions

File tree

cmd/clockify-cli/main.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -58,14 +58,14 @@ func execute() int {
5858

5959
stderr := cmd.ErrOrStderr()
6060
if errors.Is(err, terminal.InterruptErr) {
61-
fmt.Fprintln(stderr)
61+
_, _ = fmt.Fprintln(stderr)
6262
return exitCancel
6363
}
6464

6565
var flagError *cmdutil.FlagError
6666
if errors.As(err, &flagError) {
67-
fmt.Fprintln(stderr, flagError.Error())
68-
fmt.Fprintln(stderr, cmd.UsageString())
67+
_, _ = fmt.Fprintln(stderr, flagError.Error())
68+
_, _ = fmt.Fprintln(stderr, cmd.UsageString())
6969
return exitError
7070
}
7171

pkg/cmd/version/version.go

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,13 @@ func NewCmdVersion(f cmdutil.Factory) *cobra.Command {
1212
return &cobra.Command{
1313
Use: "version",
1414
Short: "Shows the CLI version",
15-
Run: func(cmd *cobra.Command, _ []string) {
15+
RunE: func(cmd *cobra.Command, _ []string) error {
1616
v := f.Version()
17-
fmt.Fprintln(cmd.OutOrStdout(),
17+
_, err := fmt.Fprintln(cmd.OutOrStdout(),
1818
"Version: "+v.Tag+", Commit: "+v.Commit+", Build At: "+v.Date,
1919
)
20+
21+
return err
2022
},
2123
}
2224
}

pkg/output/time-entry/quiet.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,9 @@ import (
1010
// TimeEntriesPrintQuietly will only print the IDs
1111
func TimeEntriesPrintQuietly(timeEntries []dto.TimeEntry, w io.Writer) error {
1212
for i := 0; i < len(timeEntries); i++ {
13-
fmt.Fprintln(w, timeEntries[i].ID)
13+
if _, err := fmt.Fprintln(w, timeEntries[i].ID); err != nil {
14+
return err
15+
}
1416
}
1517

1618
return nil

0 commit comments

Comments
 (0)