[#1718] linter: Resolve gocritic's elseif linter

See https://go-critic.com/overview#elseif for details.

Change-Id: I8fd3edfacaeea2b0a83917575d545af7e7ab4d13
Signed-off-by: Dmitrii Stepanov <d.stepanov@yadro.com>
This commit is contained in:
Dmitrii Stepanov 2025-04-16 14:40:31 +03:00
parent d2114759aa
commit 8d499f03fe
Signed by: dstepanov-yadro
GPG key ID: 237AF1A763293BC0
4 changed files with 8 additions and 16 deletions

View file

@ -655,11 +655,9 @@ func (ac *apeChecker) namespaceByOwner(ctx context.Context, owner *refs.OwnerID)
subject, err := ac.frostFSIDClient.GetSubject(ctx, addr)
if err == nil {
namespace = subject.Namespace
} else {
if !strings.Contains(err.Error(), frostfsidcore.SubjectNotFoundErrorMessage) {
} else if !strings.Contains(err.Error(), frostfsidcore.SubjectNotFoundErrorMessage) {
return "", fmt.Errorf("get subject error: %w", err)
}
}
return namespace, nil
}

View file

@ -89,11 +89,9 @@ func newTrustedTarget(ctx context.Context, prm *objectwriter.Params) (transforme
if !ownerObj.Equals(ownerSession) {
return nil, fmt.Errorf("session token is missing but object owner id (%s) is different from the default key (%s)", ownerObj, ownerSession)
}
} else {
if !ownerObj.Equals(sessionInfo.Owner) {
} else if !ownerObj.Equals(sessionInfo.Owner) {
return nil, fmt.Errorf("different token issuer and object owner identifiers %s/%s", sessionInfo.Owner, ownerObj)
}
}
if prm.SignRequestPrivateKey == nil {
prm.SignRequestPrivateKey = key

View file

@ -61,11 +61,9 @@ func (g *ExpirationChecker) IsTombstoneAvailable(ctx context.Context, a oid.Addr
logs.TombstoneCouldNotGetTheTombstoneTheSource,
zap.Error(err),
)
} else {
if ts != nil {
} else if ts != nil {
return g.handleTS(ctx, addrStr, ts, epoch)
}
}
// requested tombstone not
// found in the FrostFS network

View file

@ -436,11 +436,9 @@ func getSortedSubTree(ctx context.Context, srv TreeService_GetSubTreeServer, cid
}
if ms == nil {
ms = m.Items
} else {
if len(m.Items) != 1 {
} else if len(m.Items) != 1 {
return status.Error(codes.InvalidArgument, "multiple non-internal nodes provided")
}
}
ts = append(ts, m.Time)
ps = append(ps, p)
}