errcheck icon indicating copy to clipboard operation
errcheck copied to clipboard

this value of err is never used (SA4006)

Open 89z opened this issue 4 years ago • 4 comments

Using this program:

package main
import "strconv"

func main() {
   n, err := strconv.Atoi("99")
   if err != nil {
      panic(err)
   }
   println(n)
   _, err = strconv.Atoi("88")
}

With other tools [1], I get this error:

this value of err is never used (SA4006)

but nothing with ErrCheck. I am trying to find something that works with Go 1.18.

  1. https://github.com/dominikh/go-tools

89z avatar Mar 23 '22 18:03 89z

Sorry, I don't really understand the last bit, is staticcheck from go-tools not working with 1.18?

Errcheck doesn't really do much aside from checking if you captured the returned error. AFAIK the idea is that you can combine it with other tools to perform further analysis.

dtcaciuc avatar Mar 26 '22 03:03 dtcaciuc

staticcheck from go-tools does not work with 1.18 at this time

89z avatar Mar 26 '22 03:03 89z

Okay, I see. Other devs may weigh in on this as well, but I think your best bet would be to wait until the 1.18 compatibility.

dtcaciuc avatar Mar 26 '22 03:03 dtcaciuc

staticcheck from go-tools does not work with 1.18 at this time

It will in a couple of days :)

dominikh avatar Mar 26 '22 04:03 dominikh