Go Replaces Interface{} with 'Any'

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

Our great sponsors
  • InfluxDB - Power Real-Time Data Analytics at Scale
  • WorkOS - The modern identity platform for B2B SaaS
  • SaaSHub - Software Alternatives and Reviews
  • go

    The Go programming language

  • semver

    Semantic Versioning Specification

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

    Minimalistic package for handling Go errors in an easy way (by Vanclief)

  • I used to really hate that. After reading this amazing post https://middlemost.com/failure-is-your-domain I created a module that makes this bearable https://github.com/Vanclief/ez

  • gopherjs

    A compiler from Go to JavaScript for running Go code in a browser

  • Ok, so if Go compiled to JS it would be a dynamic language?

    https://github.com/gopherjs/gopherjs

  • errors

    Discontinued Simple error handling primitives

  • Stack trace was part of a proposal to add to the error package but it didn't happen. You can use third party errors packages like https://github.com/pkg/errors which wrap errors with stack traces.

  • rustic_result

    Result monad for Elixir inspired by Rust Result type

  • I also made a library for working with `{:ok, value}` and `{:error, reason}` in Elixir: https://github.com/linkdd/rustic_result

    Thanks to the pipeline operator and pattern matching, it makes pretty easy to read pipelines. It does not completely replace the with statement (that was not the point) but it simplified a lot of code.

  • js-proposal-algebraic-effects

    📐Let there be algebraic effects in JS

  • Ok I was wrongly assuming that panic was expecting an error type, in fact it's an interface{}.

    > Your use of exceptions for flow control (i.e. goto) is considered harmful

    Exceptions are a way to delegate error handling to the caller by giving them informations about the unexpected behavior. It implies that the expected behavior is the "happy path" (everything went well) and any deviations (errors) is unexpected.

    This is far from a goto because you can have `try/finally` blocks without catch (or defer in golang).

    Also, exceptions are just a kind of algebraic effects that do not resume. There was a proposal to JS for this: https://github.com/macabeus/js-proposal-algebraic-effects

    This is also easier to test. assertRaises(ErrorType, func() { code... })

    Almost every Go library I've seen just return an error (which is just a string), you'd need to parse it to assert that the correct error is returned in special conditions.

  • WorkOS

    The modern identity platform for B2B SaaS. The APIs are flexible and easy-to-use, supporting authentication, user identity, and complex enterprise features like SSO and SCIM provisioning.

    WorkOS logo
  • mux

    Discontinued A powerful HTTP router and URL matcher for building Go web servers with 🦍

  • I hate this pattern too but there's not "no good reason", there's a specific reason why it's like this, and it's a conscious design choice.

    When you call `go get somedomain.com/whatever/thing`, what it does is makes an HTTP request to that URL, then looks for a `` tag on the page telling it where to download the module. Check out the source of any Go project on github and you'll find the relevant `` tag. Here's the meta tag for the gorilla router, a common http routing library:

        

  • gopl.io

    Example programs from "The Go Programming Language"

  • In related news, does anyone have any idea when a new edition of Kernighan and Donavan's gopl will be released to include all the changes since 2015?

    https://www.gopl.io/

  • exhaustive

    Check exhaustiveness of switch statements of enum-like constants in Go source code.

  • https://github.com/nishanths/exhaustive

    here, have fun. You’re gonna write some tests, make new types to satisfy interfaces for testing, and then wind up with branches for your test paths in your live code, but go for it, I guess. You know everything! I am but a simple blubbite, too dim, too dim to get it.

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