zanzibar
go-exhaustruct
zanzibar | go-exhaustruct | |
---|---|---|
2 | 5 | |
451 | 100 | |
0.0% | 4.0% | |
4.6 | 7.2 | |
5 days ago | 1 day ago | |
Go | Go | |
MIT License | MIT License |
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.
zanzibar
-
I write HTTP services in Go after 13 years (Mat Ryer, 2024)
I wrote a static config class that reads configuration for the entire app / server from a JSON or YAML file ( https://github.com/uber/zanzibar/blob/master/runtime/static_... ).
Once you've loaded it and mutated it for testing purposes or for copying from ENV vars into the config, you can then freeze it before passing it down to all your app level code.
Having this wrapper object that can be frozen and has a `get()` method to read JSON like data make it effectively not mutable.
- Zanzibar: Google’s Consistent, Global Authorization System
go-exhaustruct
-
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?
casbin - An authorization library that supports access control models like ACL, RBAC, ABAC in Golang: https://discord.gg/S5UjpzGZjN
golangci-lint - Fast linters Runner for Go
Ory Keto - Open Source (Go) implementation of "Zanzibar: Google's Consistent, Global Authorization System". Ships gRPC, REST APIs, newSQL, and an easy and granular permission language. Supports ACL, RBAC, and other access models.
protolint - A pluggable linter and fixer to enforce Protocol Buffer style and conventions.
validator - :100:Go Struct and Field validation, including Cross Field, Cross Struct, Map, Slice and Array diving
jiffies - JEFRi Jiffies: minimal helpers & polyfills.
exhaustivestruct
fx - A dependency injection based application framework for Go.