testing: Fix govet errors
This commit is contained in:
parent
7238089fc7
commit
a64686fab6
|
@ -2143,7 +2143,7 @@ func vetNodeTxnOp(op *structs.TxnNodeOp, rule acl.Authorizer) error {
|
|||
var authzContext acl.AuthorizerContext
|
||||
op.FillAuthzContext(&authzContext)
|
||||
|
||||
if rule != nil && rule.NodeWrite(op.Node.Node, &authzContext) != acl.Allow {
|
||||
if rule.NodeWrite(op.Node.Node, &authzContext) != acl.Allow {
|
||||
return acl.ErrPermissionDenied
|
||||
}
|
||||
|
||||
|
|
|
@ -1225,9 +1225,7 @@ func (a *ACL) PolicyDelete(args *structs.ACLPolicyDeleteRequest, reply *string)
|
|||
return respErr
|
||||
}
|
||||
|
||||
if policy != nil {
|
||||
*reply = policy.Name
|
||||
}
|
||||
*reply = policy.Name
|
||||
|
||||
return nil
|
||||
}
|
||||
|
@ -1692,9 +1690,7 @@ func (a *ACL) RoleDelete(args *structs.ACLRoleDeleteRequest, reply *string) erro
|
|||
return respErr
|
||||
}
|
||||
|
||||
if role != nil {
|
||||
*reply = role.Name
|
||||
}
|
||||
*reply = role.Name
|
||||
|
||||
return nil
|
||||
}
|
||||
|
@ -2525,9 +2521,7 @@ func (a *ACL) Logout(args *structs.ACLLogoutRequest, reply *bool) error {
|
|||
}
|
||||
|
||||
// Purge the identity from the cache to prevent using the previous definition of the identity
|
||||
if token != nil {
|
||||
a.srv.acls.cache.RemoveIdentity(tokenSecretCacheID(token.SecretID))
|
||||
}
|
||||
a.srv.acls.cache.RemoveIdentity(tokenSecretCacheID(token.SecretID))
|
||||
|
||||
if respErr, ok := resp.(error); ok {
|
||||
return respErr
|
||||
|
|
|
@ -229,7 +229,8 @@ func (r *aclPolicyReplicator) UpdateLocalBatch(ctx context.Context, srv *Server,
|
|||
if err != nil {
|
||||
return err
|
||||
}
|
||||
if respErr, ok := resp.(error); ok && err != nil {
|
||||
|
||||
if respErr, ok := resp.(error); ok {
|
||||
return respErr
|
||||
}
|
||||
|
||||
|
@ -336,9 +337,11 @@ func (r *aclRoleReplicator) DeleteLocalBatch(srv *Server, batch []string) error
|
|||
if err != nil {
|
||||
return err
|
||||
}
|
||||
if respErr, ok := resp.(error); ok && err != nil {
|
||||
|
||||
if respErr, ok := resp.(error); ok {
|
||||
return respErr
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
|
@ -364,7 +367,8 @@ func (r *aclRoleReplicator) UpdateLocalBatch(ctx context.Context, srv *Server, s
|
|||
if err != nil {
|
||||
return err
|
||||
}
|
||||
if respErr, ok := resp.(error); ok && err != nil {
|
||||
|
||||
if respErr, ok := resp.(error); ok {
|
||||
return respErr
|
||||
}
|
||||
|
||||
|
|
|
@ -79,7 +79,8 @@ func (s *Server) reconcileLocalConfig(ctx context.Context, configs []structs.Con
|
|||
if err != nil {
|
||||
return false, fmt.Errorf("Failed to apply config %s: %v", op, err)
|
||||
}
|
||||
if respErr, ok := resp.(error); ok && err != nil {
|
||||
|
||||
if respErr, ok := resp.(error); ok {
|
||||
return false, fmt.Errorf("Failed to apply config %s: %v", op, respErr)
|
||||
}
|
||||
|
||||
|
|
|
@ -158,7 +158,8 @@ func (r *FederationStateReplicator) PerformDeletions(ctx context.Context, deleti
|
|||
if err != nil {
|
||||
return false, err
|
||||
}
|
||||
if respErr, ok := resp.(error); ok && err != nil {
|
||||
|
||||
if respErr, ok := resp.(error); ok {
|
||||
return false, respErr
|
||||
}
|
||||
|
||||
|
@ -202,7 +203,8 @@ func (r *FederationStateReplicator) PerformUpdates(ctx context.Context, updatesR
|
|||
if err != nil {
|
||||
return false, err
|
||||
}
|
||||
if respErr, ok := resp.(error); ok && err != nil {
|
||||
|
||||
if respErr, ok := resp.(error); ok {
|
||||
return false, respErr
|
||||
}
|
||||
|
||||
|
|
|
@ -219,7 +219,7 @@ func (s *Server) pruneStaleFederationStates() error {
|
|||
if err != nil {
|
||||
return fmt.Errorf("Failed to delete federation state %s: %v", dc, err)
|
||||
}
|
||||
if respErr, ok := resp.(error); ok && err != nil {
|
||||
if respErr, ok := resp.(error); ok {
|
||||
return fmt.Errorf("Failed to delete federation state %s: %v", dc, respErr)
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue