errcheck VS proposal

Compare errcheck vs proposal and see what are their differences.

errcheck

errcheck checks that you checked errors. (by kisielk)
InfluxDB - Power Real-Time Data Analytics at Scale
Get real-time insights from all types of time series data with InfluxDB. Ingest, query, and analyze billions of data points in real-time with unbounded cardinality.
www.influxdata.com
featured
SaaSHub - Software Alternatives and Reviews
SaaSHub helps you find the best software and product alternatives
www.saashub.com
featured
errcheck proposal
9 46
2,284 3,290
- 0.4%
6.3 4.4
15 days ago about 2 months ago
Go Go
MIT License BSD 3-clause "New" or "Revised" License
The number of mentions indicates the total number of mentions that we've tracked plus the number of user suggested alternatives.
Stars - the number of stars that a project has on GitHub. Growth - month over month growth in stars.
Activity is a relative number indicating how actively a project is being developed. Recent commits have higher weight than older ones.
For example, an activity of 9.0 indicates that a project is amongst the top 10% of the most actively developed projects that we are tracking.

errcheck

Posts with mentions or reviews of errcheck. We have used some of these posts to build our list of alternatives and similar projects. The last one was on 2023-08-01.
  • Linter to check for errors ignored with _
    1 project | /r/golang | 5 Nov 2023
    In our codebase I noticed a few cases where people ignored errors returned from functions by assigning them to _, ie result, _ := foo(). The errcheck linter doesn't seem to catch this, does anyone know of a linter that does?
  • Golang panics in libraries
    5 projects | dev.to | 1 Aug 2023
    And we also expect that the caller will check the error and handle it. There is a popular linter that checks it for us: errcheck.
  • Is it a bad convention to overwrite err variable?
    2 projects | /r/golang | 28 Jun 2023
    You should be using golangci-lint, because all serious Go programmers should. golangci-lint contains errcheck, which will detect if you overwrite an error without having done something with it in the meantime. I consider this one of the most important linters (this doesn't just detect things that may sorta kinda someday turn into bugs, this quite likely is a bug RIGHT NOW), and it helps you have the confidence you can overwrite errors as you go and don't need to keep allocating new ones.
  • Integration Tests failing
    1 project | /r/golang | 3 May 2023
    Run golangci-lint over your code if you haven't already and pay special attention to errcheck's output.
  • Luciano Remes | Golang is π˜Όπ™‘π™’π™€π™¨π™© Perfect
    7 projects | /r/golang | 2 Jan 2023
    errcheck has a flag for that ;)
  • Proposal: Go 2: Lightweight anonymous function syntax
    2 projects | news.ycombinator.com | 20 May 2022
    https://github.com/kisielk/errcheck, which is in most of the combined linter packages by default.

    We'll agree to disagree about unused imports; imports have can side-effects.

  • Lies we tell ourselves to keep using Golang
    13 projects | /r/programming | 29 Apr 2022
    I prefer functions returning errors over throwing exceptions. Whether it's Go's errors or ML-style options/results, they're both better than exceptions. I cannot remember the last time I had a bug from not checking an error in Go. There's also errcheck which I use as part of my linting that will catch unchecked errors, such that I cannot even commit the code.
  • I Want Off Mr. Golang's Wild Ride
    3 projects | news.ycombinator.com | 28 Apr 2022
    > Go compiler raise an error if a variable (error) goes unused

    It doesn't though. It's perfectly valid to not use the return value of a function that only returns an error, for instance.

    There are static error checking tools you can use like https://github.com/kisielk/errcheck to work around this, but most people don't use them.

    I've run into a lack of Go error checking many times. Many times it's just the trivial case, where the compiler doesn't warn about not checking the result of an error-returning function.

    But often it'll be subtler, and the result of Go's API design. One example is its file writing API, which requires you to close the file and check its error to be correct. Many times people will just `defer file.Close()`, but that isn't good enough - you're ignoring the error there.

    Worse still is e.g: writing to a file through a bufio.Writer. To be correct, you need to remember to flush the writer, check that error, then close the file and check that error. There's no type-level support to make sure you do that.

  • Trying Out Generics in Go
    7 projects | news.ycombinator.com | 16 Dec 2021
    I'd be really happy with that! Building the functionality of errcheck[1] and ineffassign[2] into the compiler β€” or at the very least, into govet β€” would go a long way to allay my worries with Go.

    I think the reason they don't do this is that it's a slight (albeit a very tiny one) against Go's philosophy of errors being values, just like any other. While the `error` type is standard and used throughout Go source code, it still just has a simple three-line definition[3] and is not treated as a special case anywhere else; there is nothing stopping you from returning your own error type if you wish. A third-party linter could simply check for the `error` type specifically, but the first-party tools should not, and there's nothing like Rust's `#[must_use]` attribute that could be used instead. I respect Go's philosophy, but I feel like pragmatism must win in this case.

    [1]: https://github.com/kisielk/errcheck

proposal

Posts with mentions or reviews of proposal. We have used some of these posts to build our list of alternatives and similar projects. The last one was on 2023-10-20.
  • Does Go Have Subtyping?
    3 projects | news.ycombinator.com | 20 Oct 2023
    The conclusion is pretty weird to me.

    Go does rely on monomorphization for generics, just like C++ and Rust. The only difference is that this is an implementation detail, so Go can group multiple monomorphizations without worrying about anything else [1]. This form of hybrid monomorphization is being increasingly common, GHC does that and Rust is also trying to do so [2], so nothing special for Go here.

    On the other hand, explaining variance as a lifted polymorphism is---while not incorrect per se---also weird in part because a lack of variance is at worst just an annoyance. You can always make an adopter to unify heterogeneous types. Rust calls it `Box`, Go happens to call it an interface type instead. Both languages even do not allow heterogeneous concrete (or runtime) types in a single slice! So variance has no use in both languages because no concrete types are eligible for variance anyway.

    I think the conclusion got weird because the term "subtyping" is being misused. Subtyping, in the broadest sense, is just a non-trivial type relation. Many languages thus have a multiple notion of subtyping, often (almost) identical to each other but sometimes not. Go in particular has a lot of them, and even some relation like "T implements U" is a straightforward record subtyping. It is no surprise that the non-uniform value representation has the largest influence, and only monomorphization schemes and hetero-to-homogeneous adapters vary in this particular group.

    [1] https://github.com/golang/proposal/blob/master/design/generi...

    [2] https://rust-lang.github.io/compiler-team/working-groups/pol...

  • Backward Compatibility, Go 1.21, and Go 2
    6 projects | news.ycombinator.com | 14 Aug 2023
  • Defining interfaces in C++ with β€˜concepts’ (C++20)
    1 project | news.ycombinator.com | 19 Apr 2023
    https://github.com/golang/proposal/blob/master/design/generi...
  • Why Turborepo is migrating from Go to Rust – Vercel
    7 projects | /r/golang | 8 Mar 2023
    Go Team wanted generics since the start. It was always a problem implementing them without severely hurting compile time and creating compilation bloat. Rust chose to ignore this problem, by relying on LLVM backend for optimizations and dead code elimination.
  • Are you a real programmer if you use VS Code? No Says OP in the byte sized drama
    1 project | /r/SubredditDrama | 24 Jan 2023
    Hold up, did the members actually push this forward or was support just often memed about and suddenly this proposal was made: https://github.com/golang/proposal/blob/master/design/43651-type-parameters.md
  • Major standard library changes in Go 1.20
    5 projects | news.ycombinator.com | 16 Jan 2023
    As far as I can tell, the consensus for generics was "it will happen, but we really want to get this right, and it's taking time."

    I know some people did the knee-jerk attacks like "Go sucks, it should have had generics long ago" or "Go is fine, it doesn't need generics". I don't think we ever needed to take those attitudes seriously.

    > Will error handling be overhauled or not?

    Error handling is a thorny issue. It's the biggest complaint people have about Go, but I don't think that exceptions are obviously better, and the discriminated unions that power errors in Rust and some other languages are conspicuously absent from Go. So you end up with a bunch of different proposals for Go error handling that are either too radical or little more than syntactic sugar. The syntactic sugar proposals leave much to be desired. It looks like people are slowly grinding through these proposals until one is found with the right balance to it.

    I honestly don't know what kind of changes to error handling would appear in Go 2 if/when it lands, and I think the only reasonable answer right now is "wait and find out". You can see a more reasonable proposal here:

    https://github.com/golang/proposal/blob/master/design/go2dra...

    Characterizing it as a "lack of vision" does not seem fair here--I started using Rust back in the days when boxed pointers had ~ on them, and it seemed like it took Rust a lot of iterations to get to the current design. Which is fine. I am also never quite sure what is going to get added to future versions of C#.

    I am also not quite sure why Go gets so much hate on Hacker News--as far as I can tell, people have more or less given up on criticizing Java and C# (it's not like they've ossified), and C++ is enough of a dumpster fire that it seems gauche to point it out.

  • Go's Future v2 and Go's Versioning
    1 project | /r/golang | 25 Nov 2022
    There will almost certainly not be a Go 2 in that sense. There is a Go 2 transition doc which extensively discusses what "Go 2" means. The conclusion is
  • What's the status of the various "Go 2" proposals?
    2 projects | /r/golang | 15 Nov 2022
    As it says on that page - those were not proposals. They were draft ideas to get feedback on. You can see the list of proposals in this repository: https://github.com/golang/proposal
  • An alternative memory limiter for Go based on GC tuning and request throttling
    2 projects | /r/golang | 5 Oct 2022
    Approximately a year ago we faced with a necessity of limiting Go runtime memory consumption and started work on our own memory limiter. At the same time, Michael Knyszek published his well-known proposal. Now we have our own implementation quite similar to what has been released in 1.18, but there are two key differences:
  • Shaving 40% off Google’s B-Tree Implementation with Go Generics
    2 projects | /r/golang | 7 Aug 2022

What are some alternatives?

When comparing errcheck and proposal you can also consider the following projects:

GoLint - [mirror] This is a linter for Go source code. (deprecated)

go - The Go programming language

staticcheck

vscode-gremlins - Gremlins tracker for Visual Studio Code: reveals invisible whitespace and other annoying characters

gosimple

avendish - declarative polyamorous cross-system intermedia objects

gcvis - Visualise Go program GC trace data in real time

too-many-lists - Learn Rust by writing Entirely Too Many linked lists

apicompat - apicompat checks recent changes to a Go project for backwards incompatible changes

go-generic-optional - Implementation of Optionals in Go using Generics

Go Metalinter

go_chainable - With generics, allowing chainable .Map(func(...)).Reduce(func(...)) syntax in go