We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Reviewing https://github.com/letsencrypt/boulder/pull/7869/files/b7189f5c31798523fe61d1be0a40363cb9e9fa30..81b616be22710d38b2193f200f63a9c2bed86637#diff-ba4749ac861bae77ee5067820eff8d269f6ede6202108c0238a1809726d066d3R224-R236, I notice that we now have a pattern of partially initializing a struct, then validating its contents, then precomputing some internal fields:
lim := &limit{ burst: v.Burst, count: v.Count, period: v.Period, name: name, } err := validateLimit(lim) if err != nil { return nil, fmt.Errorf("parsing default limit %q: %w", k, err) } lim.precompute()
This is a great use case for a constructor that returns an error:
func newLimit(name string, config LimitConfig) (*limit, error) {
That way we can reduce the chance of winding up with a partially-initialized limit object, and also reduce boilerplate a little bit.
limit
The text was updated successfully, but these errors were encountered:
No branches or pull requests
Reviewing https://github.com/letsencrypt/boulder/pull/7869/files/b7189f5c31798523fe61d1be0a40363cb9e9fa30..81b616be22710d38b2193f200f63a9c2bed86637#diff-ba4749ac861bae77ee5067820eff8d269f6ede6202108c0238a1809726d066d3R224-R236, I notice that we now have a pattern of partially initializing a struct, then validating its contents, then precomputing some internal fields:
This is a great use case for a constructor that returns an error:
That way we can reduce the chance of winding up with a partially-initialized
limit
object, and also reduce boilerplate a little bit.The text was updated successfully, but these errors were encountered: