typeregistry
create type dynamically in Golang (by xiaoxin01)
go-enum
An enum generator for go (by abice)
Our great sponsors
- InfluxDB - Collect and Analyze Billions of Data Points in Real Time
- Onboard AI - Learn any GitHub repo in 59 seconds
- SaaSHub - Software Alternatives and Reviews
typeregistry | go-enum | |
---|---|---|
0 | 7 | |
23 | 580 | |
- | - | |
0.0 | 7.3 | |
almost 4 years ago | 8 days ago | |
Go | Go | |
MIT License | MIT 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.
typeregistry
Posts with mentions or reviews of typeregistry.
We have used some of these posts to build our list of alternatives
and similar projects.
We haven't tracked posts mentioning typeregistry yet.
Tracking mentions began in Dec 2020.
go-enum
Posts with mentions or reviews of go-enum.
We have used some of these posts to build our list of alternatives
and similar projects. The last one was on 2023-07-18.
-
Ten Years of “Go: The Good, the Bad, and the Meh
While not perfect, there are ways to generate enums automatically using go:generate, e.g. https://github.com/abice/go-enum
-
Go vs Rust
I wouldn't write a macro to save a couple of lines, but I would definitely use (not even write, just use) a macro for something like generating enum [de]serialization for both JSON and BSON in one line. Go, even with generics, still has no way of abstracting extremely common patterns like enums without separate generator tools. Clearly someone thought the macro was useful here, but without a macro they had no choice but to write a separate tool.
-
Why no enums?
I've worked in a few different languages and Go doesn't seem all that unique in the way that it doesn't provide an ENUM primitive. However, I looked around a bit and found go-enum which seems pretty neat. Also, I have no problem writing a custom string or int/iota type. In some cases you want to be able to serialize/deserialize with them -- and in others you don't need that.
I wish we had real enums. It’s hard to standardize iota enum implementation across an entire org. I use https://github.com/abice/go-enum at my company to help reduce all the boiler plate / standardize implementation, not perfect but it makes it easier
-
Does Go not have enums in the sense that I can use them as a type?
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
-
How to do Enums in Go
Looks like this does what you want: https://github.com/abice/go-enum
What are some alternatives?
When comparing typeregistry and go-enum you can also consider the following projects:
goderive - Derives and generates mundane golang functions that you do not want to maintain yourself
gotype - Golang source code parsing, usage like reflect package
GoWrap - GoWrap is a command line tool for generating decorators for Go interfaces
go-xray - Helpers for making the use of reflection easier
generis - Versatile Go code generator.
goverter - Generate type-safe Go converters by simply defining an interface