Why are enums not a thing 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

    The Go programming language

    There have been many proposals to add enums. The earliest I found is this (2017), but they are still debating if it's worth "the complexity".

  • enumeration

    Enumerations for Go - a really useful yet easy-to-use code generator (by rickb777)

    I regularly use a tool I maintain (that I derived from others' work) that generates the enums I need for me. (https://github.com/rickb777/enumeration)

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

  • enumcheck

    Allows to mark Go enum types as exhaustive.

    closed set of enumerated values/types; use a linter, e.g. enumcheck

  • texpack

    Texture packer with image, font and sdf support.

    enumerated set based on file tree; similarly, code generator can help (e.g. see texture packing)

  • exhaustive

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

    Use a linter.

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

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