exhaustivestruct
By mbilski
go-exhaustruct
golang analyzer that finds structures with uninitialized fields (by GaijinEntertainment)
exhaustivestruct | go-exhaustruct | |
---|---|---|
3 | 6 | |
26 | 114 | |
- | 4.4% | |
0.0 | 6.8 | |
over 2 years ago | about 1 month 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.
exhaustivestruct
Posts with mentions or reviews of exhaustivestruct.
We have used some of these posts to build our list of alternatives
and similar projects. The last one was on 2022-10-03.
-
allfields - new linter for copy data from one struct to another
That's why golangci-lint has both exhaustivestruct as well as exhaustruct already.
-
structinit: tool for checking that structs are initialized with all their fields
This is already possible with this tool: https://github.com/mbilski/exhaustivestruct
-
Interest for a new static analysis tool for full struct initialization
A tool like this already exists: https://github.com/mbilski/exhaustivestruct, but it checks all structs of a given name/pattern, or all structs in a given pattern.
go-exhaustruct
Posts with mentions or reviews of go-exhaustruct.
We have used some of these posts to build our list of alternatives
and similar projects. The last one was on 2024-07-05.
-
I Have No Constructor, and I Must Initialize
https://github.com/GaijinEntertainment/go-exhaustruct
to enforce all fields initialized.
If you care, the linter is there, so this is more of a skill issue.
-
I write HTTP services in Go after 13 years (Mat Ryer, 2024)
Because go doesn’t have exhaustiveness checking when initialising structs. Instead it encourages “make the zero value meaningful” which is not always possible not desirable. I usually use a linter to catch this kind of problem https://github.com/GaijinEntertainment/go-exhaustruct
-
allfields - new linter for copy data from one struct to another
That's why golangci-lint has both exhaustivestruct as well as exhaustruct already.
-
How to ensure required fields in struct consistently?
Have you consider adding a linter as part of you build process to detect those un-initialized fields? Like go-exhaustruct, (it's already included in golangci-lint if you use that already)
-
Obsticals of migrating from Typescript to Rust
I moved from typescript to golang and I can't recommend it enough. And you'll avoid most undefined / nil exceptions if you use the exhaustruct linter.
What are some alternatives?
When comparing exhaustivestruct and go-exhaustruct you can also consider the following projects:
structinit - Go static analysis tool that checks that structs with tagged declarations have all their values initialized in a struct literal.
protolint - A pluggable linter and fixer to enforce Protocol Buffer style and conventions.
go - The Go programming language
golangci-lint - Fast linters runner for Go
jiffies - JEFRi Jiffies: minimal helpers & polyfills.
validator - :100:Go Struct and Field validation, including Cross Field, Cross Struct, Map, Slice and Array diving
downstream - Tool for finding interesting forks of projects on GitHub.
fx - A dependency injection based application framework for Go.