enumer
A Go tool to auto generate methods for your enums (by dmarkham)
enumeration
Enumerations for Go - a really useful yet easy-to-use code generator (by rickb777)
enumer | enumeration | |
---|---|---|
6 | 3 | |
373 | 12 | |
- | - | |
2.3 | 5.6 | |
3 months ago | 22 days ago | |
Go | Go | |
GNU General Public License v3.0 or later | BSD 3-clause "New" or "Revised" License |
The number of mentions indicates the total number of mentions that we've tracked plus the number of user suggested alternatives.
Stars - the number of stars that a project has on GitHub. Growth - month over month growth in stars.
Activity is a relative number indicating how actively a project is being developed. Recent commits have higher weight than older ones.
For example, an activity of 9.0 indicates that a project is amongst the top 10% of the most actively developed projects that we are tracking.
Stars - the number of stars that a project has on GitHub. Growth - month over month growth in stars.
Activity is a relative number indicating how actively a project is being developed. Recent commits have higher weight than older ones.
For example, an activity of 9.0 indicates that a project is amongst the top 10% of the most actively developed projects that we are tracking.
enumer
Posts with mentions or reviews of enumer.
We have used some of these posts to build our list of alternatives
and similar projects. The last one was on 2024-03-28.
- Go Enums Still Suck
-
Go isn't the right tool for ANY job
Just use const blocks, iota and enumer and be happy.
-
Does Go not have enums in the sense that I can use them as a type?
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
-
Safer Enums in Go
We tried out struct-based enums like this for a while and they're definitely better than the vanilla version, but they still have the problem of "how do you iterate over all the values?" and "how do you create an enum value from a string?". We chanced upon https://github.com/dmarkham/enumer a few months ago and have been very happy so far.
Use enumer in combination with what some of this article.
- What I'd like to see in Go 2.0
enumeration
Posts with mentions or reviews of enumeration.
We have used some of these posts to build our list of alternatives
and similar projects. The last one was on 2022-05-22.
-
Why are enums not a thing in Go?
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)
-
How to type a string literal union (or a string enum) in Go?
My tool (https://github.com/rickb777/enumeration) is derived from the excellent work of others; I added serialisation and DB storage features. See the readme.
-
Safer Enums in Go
In Go, I've been quite satisfied with the integer-based constants first blogged about, I think, by Russ Cox. A simple enum code generator was offered; I've developed this idea further in my own tool (https://github.com/rickb777/enumeration).
What are some alternatives?
When comparing enumer and enumeration you can also consider the following projects:
go-sumtype - A simple utility for running exhaustiveness checks on Go "sum types."
enumcheck - Allows to mark Go enum types as exhaustive.
go101 - An up-to-date (unofficial) knowledge base for Go programming self learning
go - The Go programming language
yaegi - Yaegi is Another Elegant Go Interpreter
texpack - Texture packer with image, font and sdf support.
go-retry - Go library for retrying with configurable backoffs
exhaustive - Check exhaustiveness of switch statements of enum-like constants in Go source code.
codegena - Codegeneration tool
yaegi-template - Use yaegi as a template engine.
go-enumer - ✨ Go-Enums with Magic ✨