Does Go not have enums in the sense that I can use them as a type?

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

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

    Package validator implements struct field validations (by go-validator)

  • go-enum

    An enum generator for go

  • Along that same line you can take it a step further and generate the iota block too with this tool https://github.com/abice/go-enum

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

    A Go tool to auto generate methods for your enums (by dmarkham)

  • Define your type as an alias on int and values using iota as others have said, then autogenerate the rest of the functionality from other languages with https://github.com/dmarkham/enumer

  • go

    The Go programming language

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