Rusty enums in Go

This page summarizes the projects mentioned and recommended in the original post on /r/golang

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

    A simple utility for running exhaustiveness checks on Go "sum types."

  • A Google search for golang sum types currently shows my project as a second hit: https://github.com/BurntSushi/go-sumtype

  • exhaustive

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

  • I tried to find that linter and found this: exhaustive

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

    The Go programming language

  • Really, the way Go interfaces silently collapse is unthinkably insane if you really look at it, and the only mitigation is that we just accept the idea that interfaces can never change once they're first created, which leads to other insane design choices like http.ResponseController, a stark admission that interface evolution is impossible, and a precedent that other interfaces are likely to follow.

  • enumcheck

    Allows to mark Go enum types as exhaustive.

  • You can write a linter that checks for exhaustiveness. I wrote a proof-of-concept some time ago: https://github.com/loov/enumcheck... so probably doesn't work with generics.

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