removed unecessary guard statements

pull/1688/head
Panagiotis Siatras 4 months ago
parent 48d59b5219
commit d701368f23
No known key found for this signature in database

@ -105,7 +105,7 @@ type Authority struct {
// If true, do not output initialization logs
quietInit bool
// When not nil, called whenever applicable.
// Called whenever applicable, in order to instrument the authority.
meter Meter
}
@ -187,10 +187,6 @@ func NewEmbedded(opts ...Option) (*Authority, error) {
}
}
if a.meter == nil {
a.meter = noopMeter{}
}
return a, nil
}
@ -969,16 +965,15 @@ func (a *Authority) startCRLGenerator() error {
}
//nolint:gocritic // used in defered statements
func (a *Authority) incrProvisionerCounter(p *provisioner.Interface, err *error, count func(Meter, string, bool)) {
func (a *Authority) incrProvisionerCounter(prov *provisioner.Interface, err *error, count func(Meter, string, bool)) {
var name string
if prov := *p; prov != nil {
name = prov.GetName()
if p := *prov; p != nil {
name = p.GetName()
}
count(a.meter, name, err == nil || *err == nil)
count(a.meter, name, *err == nil)
}
//nolint:gocritic // used in defered statements
func (a *Authority) incrWebhookCounter(prov provisioner.Interface, err error, count func(Meter, string, bool)) {
var name string
if prov != nil {

@ -388,8 +388,9 @@ func WithMeter(m Meter) Option {
m = noopMeter{}
}
return func(a *Authority) error {
return func(a *Authority) (_ error) {
a.meter = m
return nil
return
}
}

Loading…
Cancel
Save