News for hackers. Stuff that matters.
Re:Go is moving to GitHub by NateDad on Friday November 14, 2014 @01:32PM (#8608672)
> think most of this could be solved easily by either a compiler option or golint rule

You mean like errcheck? https://github.com/kisielk/errcheck

I'm not sure if it can find spots where people intentionally throw away an error like in

    val, _ := foo()
Usually people are more concerned with places where people accidentally fail to realize there's an error returned at all, like this:

    func foo() error { ... }

    foo() // errcheck finds this
However, it should be possible to find errors assigned to underscores, and thus detect that case.
Re:Go is moving to GitHub by acdha on Friday November 14, 2014 @02:30PM (#8609006)
Ideally that'd move into the standard suite and you'd have to do something like compile with --repeat-the-mistakes-of-c to skip it.

I've noticed most of the intention error punts in dense code where it looked like someone got tired of repeating checks and only checked the errors which happened while they were working. I'd bet a read-before-overwrite policy on _ would catch mostly infrequent environmental failures (i.e. the kind of stuff which only breaks when you're out of space, file handles, etc.).

Re:Go is moving to GitHub by NateDad on Saturday November 15, 2014 @06:32AM (#8611467)
Anyone who intentionally throws away errors because they "got tired" of checking errors, isn't someone I'd want on my team, and their code is not something I'd want to depend on, regardless of the language. Hopefully it would get caught in code review. But yes, it would be nice if go vet or go lint caught this syuff. Luckily, someone else wrote errcheck, and that's good enough.