refactor(util): remove duplicate lg check
lg always has a value Signed-off-by: aimuz <mr.imuz@gmail.com>dependabot/go_modules/github.com/prometheus/procfs-0.11.0
parent
211b4320c3
commit
b052092297
|
@ -35,13 +35,11 @@ func discoverEndpoints(lg *zap.Logger, dns string, ca string, insecure bool, ser
|
||||||
}
|
}
|
||||||
endpoints := srvs.Endpoints
|
endpoints := srvs.Endpoints
|
||||||
|
|
||||||
if lg != nil {
|
lg.Info(
|
||||||
lg.Info(
|
"discovered cluster from SRV",
|
||||||
"discovered cluster from SRV",
|
zap.String("srv-server", dns),
|
||||||
zap.String("srv-server", dns),
|
zap.Strings("endpoints", endpoints),
|
||||||
zap.Strings("endpoints", endpoints),
|
)
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
if insecure {
|
if insecure {
|
||||||
return *srvs
|
return *srvs
|
||||||
|
@ -52,32 +50,26 @@ func discoverEndpoints(lg *zap.Logger, dns string, ca string, insecure bool, ser
|
||||||
ServerName: dns,
|
ServerName: dns,
|
||||||
}
|
}
|
||||||
|
|
||||||
if lg != nil {
|
lg.Info(
|
||||||
lg.Info(
|
"validating discovered SRV endpoints",
|
||||||
"validating discovered SRV endpoints",
|
zap.String("srv-server", dns),
|
||||||
zap.String("srv-server", dns),
|
zap.Strings("endpoints", endpoints),
|
||||||
zap.Strings("endpoints", endpoints),
|
)
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
endpoints, err = transport.ValidateSecureEndpoints(tlsInfo, endpoints)
|
endpoints, err = transport.ValidateSecureEndpoints(tlsInfo, endpoints)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
if lg != nil {
|
lg.Warn(
|
||||||
lg.Warn(
|
"failed to validate discovered endpoints",
|
||||||
"failed to validate discovered endpoints",
|
zap.String("srv-server", dns),
|
||||||
zap.String("srv-server", dns),
|
zap.Strings("endpoints", endpoints),
|
||||||
zap.Strings("endpoints", endpoints),
|
zap.Error(err),
|
||||||
zap.Error(err),
|
)
|
||||||
)
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
if lg != nil {
|
lg.Info(
|
||||||
lg.Info(
|
"using validated discovered SRV endpoints",
|
||||||
"using validated discovered SRV endpoints",
|
zap.String("srv-server", dns),
|
||||||
zap.String("srv-server", dns),
|
zap.Strings("endpoints", endpoints),
|
||||||
zap.Strings("endpoints", endpoints),
|
)
|
||||||
)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// map endpoints back to SRVClients struct with SRV data
|
// map endpoints back to SRVClients struct with SRV data
|
||||||
|
|
Loading…
Reference in New Issue