Function with cyclomatic complexity higher than threshold GO-R1005
Anti-pattern
Minor
2 occurrences in this check
func TransferPrimary has a cyclomatic complexity of 16 with "high" risk
 82}
 83
 84// TransferPrimary transfers the primary of the specified service.
 85func TransferPrimary(client *clientv3.Client, serviceName, oldPrimary, newPrimary string, keyspaceGroupID uint32) error { 86	log.Info("transfer primary", zap.String("service", serviceName), zap.String("from", oldPrimary), zap.String("to", newPrimary))
 87	entries, err := GetMSMembers(serviceName, client)
 88	if err != nil {
func Watch has a cyclomatic complexity of 27 with "very-high" risk
252
253// Watch is used to watch the changes of the leadership, usually is used to
254// detect the leadership stepping down and restart an election as soon as possible.
255func (ls *Leadership) Watch(serverCtx context.Context, revision int64) {256	if ls == nil {
257		return
258	}