mirror of https://github.com/status-im/consul.git
testing: Fix govet errors
This commit is contained in:
parent
69ffd9ae01
commit
aa212423e3
|
@ -2143,7 +2143,7 @@ func vetNodeTxnOp(op *structs.TxnNodeOp, rule acl.Authorizer) error {
|
||||||
var authzContext acl.AuthorizerContext
|
var authzContext acl.AuthorizerContext
|
||||||
op.FillAuthzContext(&authzContext)
|
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
|
return acl.ErrPermissionDenied
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1225,9 +1225,7 @@ func (a *ACL) PolicyDelete(args *structs.ACLPolicyDeleteRequest, reply *string)
|
||||||
return respErr
|
return respErr
|
||||||
}
|
}
|
||||||
|
|
||||||
if policy != nil {
|
|
||||||
*reply = policy.Name
|
*reply = policy.Name
|
||||||
}
|
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
@ -1692,9 +1690,7 @@ func (a *ACL) RoleDelete(args *structs.ACLRoleDeleteRequest, reply *string) erro
|
||||||
return respErr
|
return respErr
|
||||||
}
|
}
|
||||||
|
|
||||||
if role != nil {
|
|
||||||
*reply = role.Name
|
*reply = role.Name
|
||||||
}
|
|
||||||
|
|
||||||
return nil
|
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
|
// 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 {
|
if respErr, ok := resp.(error); ok {
|
||||||
return respErr
|
return respErr
|
||||||
|
|
|
@ -229,7 +229,8 @@ func (r *aclPolicyReplicator) UpdateLocalBatch(ctx context.Context, srv *Server,
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
if respErr, ok := resp.(error); ok && err != nil {
|
|
||||||
|
if respErr, ok := resp.(error); ok {
|
||||||
return respErr
|
return respErr
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -336,9 +337,11 @@ func (r *aclRoleReplicator) DeleteLocalBatch(srv *Server, batch []string) error
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
if respErr, ok := resp.(error); ok && err != nil {
|
|
||||||
|
if respErr, ok := resp.(error); ok {
|
||||||
return respErr
|
return respErr
|
||||||
}
|
}
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -364,7 +367,8 @@ func (r *aclRoleReplicator) UpdateLocalBatch(ctx context.Context, srv *Server, s
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
if respErr, ok := resp.(error); ok && err != nil {
|
|
||||||
|
if respErr, ok := resp.(error); ok {
|
||||||
return respErr
|
return respErr
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -79,7 +79,8 @@ func (s *Server) reconcileLocalConfig(ctx context.Context, configs []structs.Con
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return false, fmt.Errorf("Failed to apply config %s: %v", op, err)
|
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)
|
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 {
|
if err != nil {
|
||||||
return false, err
|
return false, err
|
||||||
}
|
}
|
||||||
if respErr, ok := resp.(error); ok && err != nil {
|
|
||||||
|
if respErr, ok := resp.(error); ok {
|
||||||
return false, respErr
|
return false, respErr
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -202,7 +203,8 @@ func (r *FederationStateReplicator) PerformUpdates(ctx context.Context, updatesR
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return false, err
|
return false, err
|
||||||
}
|
}
|
||||||
if respErr, ok := resp.(error); ok && err != nil {
|
|
||||||
|
if respErr, ok := resp.(error); ok {
|
||||||
return false, respErr
|
return false, respErr
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -219,7 +219,7 @@ func (s *Server) pruneStaleFederationStates() error {
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return fmt.Errorf("Failed to delete federation state %s: %v", dc, err)
|
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)
|
return fmt.Errorf("Failed to delete federation state %s: %v", dc, respErr)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue