Skip to content

Commit

Permalink
refactoring the writing string
Browse files Browse the repository at this point in the history
  • Loading branch information
nabim777 committed Aug 28, 2023
1 parent 2ab199f commit f173f17
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,10 +44,10 @@ type shift struct {
newPath string
}

func writeString(out io.Writer, msg string) (error){
func writeString(out io.Writer, msg string) error {
_, err := io.WriteString(out, msg)
if err != nil {
io.WriteString(out, err.Error())
_, _ = io.WriteString(out, err.Error()) // Writing error message
return err
}
return nil
Expand Down Expand Up @@ -81,10 +81,8 @@ func getShifts(out io.Writer) int {
if found {
if o.LineNumber != l.LineNumber {
writeString(out, "Found Shift\n")

Check failure on line 83 in main.go

View workflow job for this annotation

GitHub Actions / build

Error return value is not checked (errcheck)
writeString(out, "Old: "+getTestPath(o))
writeString(out, "\n")
writeString(out, "New: "+getTestPath(l))
writeString(out, "\n\n")
_, _ = io.WriteString(out, "New: "+getTestPath(l)+"\n")
_, _ = io.WriteString(out, "\n\n")

shifts = append(shifts, shift{getTestPath(o), getTestPath(l)})
}
Expand Down

0 comments on commit f173f17

Please sign in to comment.