Skip to content

Commit

Permalink
🚨 Fix lint warning
Browse files Browse the repository at this point in the history
Type asserting to convert an interface (error) to the concrete type is
unnecessary when using errors.As. The documentation states the
following:

> As finds the first error in err's chain that matches target, and if
> one is found, sets target to that error value and returns true.
> Otherwise, it returns false.

Remove the assertion as the error was already stored in the variable.
The path stored in the error can be directly accessed.
  • Loading branch information
mikelorant committed Feb 4, 2023
1 parent c741a68 commit 30ffbb8
Showing 1 changed file with 0 additions and 2 deletions.
2 changes: 0 additions & 2 deletions internal/shell/shell.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,6 @@ func Run(w io.Writer, command string, args []string) error {
return fmt.Errorf("unable to copy commit output: %w", err)
}

//nolint:errorlint
pathError = err.(*fs.PathError)
if pathError.Path != "/dev/ptmx" {
return fmt.Errorf("unable to copy commit output: %v: %w", pathError.Path, pathError.Err)
}
Expand Down

0 comments on commit 30ffbb8

Please sign in to comment.