Go’ing Insane: Endless Error Handling

This page summarizes the projects mentioned and recommended in the original post on news.ycombinator.com

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
  • go

    The Go programming language

  • In 2019, Russ Cox acknowledged three of the most commonly reported Go pain points:

    > The top three pain points for Go users, in surveys and direct feedback, have been consistent for a number of years. They are: package management, generics, and error handling. We are working on all three.

    The first has been solved, the second is in the process of being solved, and the third has been addressed in two major proposals, both of which were rejected. I sympathize with the author's frustration, though I would argue that better error handling in Go is still being actively discussed and investigated.

    https://twitter.com/_rsc/status/1146129898383302656

    https://go.dev/blog/go2draft

    1. Package management has, more or less, been solved through minimum version selection in modules/vgo. Though not everyone's favorite, at least it doesn't require a SAT-solver (dependency hell is NP-complete https://research.swtch.com/version-sat)

    https://github.com/golang/go/issues/24301

    https://go.googlesource.com/proposal/+/master/design/24301-v...

    https://research.swtch.com/vgo

    https://golang.org/ref/mod

    https://github.com/golang/go/wiki/Modules

    https://go.dev/blog/using-go-modules

    https://golang.org/doc/tutorial/create-module

    2. Parametric polymorphism/Type Parameters ("generics") is/are being introduced into the language in 1.18, which is slated for release in early 2022.

    https://github.com/golang/go/issues/43651

    https://go.googlesource.com/proposal/+/master/design/43651-t...

    3. There have now been a couple of proposals to make error handling simpler and reduce boilerplate

    https://github.com/golang/go/wiki/Go2ErrorHandlingFeedback

    check/handle

    https://go.googlesource.com/proposal/+/master/design/go2draf...

    https://go.googlesource.com/proposal/+/master/design/go2draf...

    try

    https://github.com/golang/go/issues/32437

    https://go.googlesource.com/proposal/+/master/design/32437-t...

    related

    https://go.googlesource.com/proposal/+/master/design/go2draf...

    https://go.googlesource.com/proposal/+/master/design/go2draf...

    https://go.googlesource.com/proposal/+/master/design/go2draf...

  • ocaml

    The core OCaml system: compilers, runtime system, base libraries

  • 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.

    InfluxDB logo
  • rfcs

    RFCs for changes to Rust

  • (This isn’t exactly how it’s implemented—that detail is unstable and has actually changed <https://github.com/rust-lang/rfcs/pull/3058> since ? was stabilised!—but it’s equivalent in this instance. As examples of how it’s not exact: you can use ? on Option too; and inside a try block (unstable), ? isn’t a return, acting more like a break-with-value.)

    For wrapping the error: note the .into() in the desugaring: it’ll perform any necessary type conversions which is the normal way you’d do error wrapping. But if you want to do anything more than that, or adding specific context, you’re still in luck! You can use method chaining to manipulate the result. In the standard library is map_err <https://doc.rust-lang.org/std/result/enum.Result.html#method...>:

      foo().map_err(|err| f(err))?

NOTE: The number of mentions on this list indicates mentions on common posts plus user suggested alternatives. Hence, a higher number means a more popular project.

Suggest a related project

Related posts

  • Why does Rust bindgen have bitfields?

    3 projects | /r/rust | 10 Jun 2022
  • Security vulnerability in Rust standard library

    4 projects | news.ycombinator.com | 21 Jan 2022
  • 7 Programming Languages Every Cloud Engineer Should Know in 2024!

    4 projects | dev.to | 5 Mar 2024
  • Why stdout is faster than stderr?

    2 projects | news.ycombinator.com | 10 Jan 2024
  • Odin Programming Language

    23 projects | news.ycombinator.com | 1 Jan 2024