Skip to content

Commit

Permalink
Fix lint
Browse files Browse the repository at this point in the history
  • Loading branch information
navnitms committed Jan 4, 2025
1 parent 895d3f6 commit 690366f
Showing 1 changed file with 16 additions and 5 deletions.
21 changes: 16 additions & 5 deletions internal/controlplane/handlers_profile.go
Original file line number Diff line number Diff line change
Expand Up @@ -662,11 +662,14 @@ func (s *Server) processProfileStatusByName(
return nil, err
}

// Only fetch rule evaluations if selector is present or all is requested
if selector != nil || req.GetAll() {
var entityID uuid.NullUUID
if selector != nil {
entityID = *selector
}
dbRuleEvaluationStatuses, err := s.store.ListRuleEvaluationsByProfileId(ctx, db.ListRuleEvaluationsByProfileIdParams{
ProfileID: profileID,
EntityID: *selector, // Safe now as we check for nil
EntityID: entityID,
RuleTypeName: *ruleType,
RuleName: *ruleName,
})
Expand Down Expand Up @@ -712,9 +715,13 @@ func (s *Server) processProfileStatusById(

// Only fetch rule evaluations if selector is present or all is requested
if selector != nil || req.GetAll() {
var entityID uuid.NullUUID
if selector != nil {
entityID = *selector
}
dbRuleEvaluationStatuses, err := s.store.ListRuleEvaluationsByProfileId(ctx, db.ListRuleEvaluationsByProfileIdParams{
ProfileID: profileID,
EntityID: *selector, // Safe now as we check for nil
EntityID: *&entityID,

Check failure on line 724 in internal/controlplane/handlers_profile.go

View workflow job for this annotation

GitHub Actions / lint / Run golangci-lint

SA4001: *&x will be simplified to x. It will not copy x. (staticcheck)
RuleTypeName: *ruleType,
RuleName: *ruleName,
})
Expand Down Expand Up @@ -743,7 +750,9 @@ func (s *Server) processProfileStatusById(
}, nil
}

func extractFiltersFromNameRequest(req *minderv1.GetProfileStatusByNameRequest) (*uuid.NullUUID, *sql.NullString, *sql.NullString, error) {
func extractFiltersFromNameRequest(
req *minderv1.GetProfileStatusByNameRequest) (
*uuid.NullUUID, *sql.NullString, *sql.NullString, error) {
if e := req.GetEntity(); e != nil {
if !e.GetType().IsValid() {
return nil, nil, nil, util.UserVisibleError(codes.InvalidArgument,
Expand Down Expand Up @@ -774,7 +783,9 @@ func extractFiltersFromNameRequest(req *minderv1.GetProfileStatusByNameRequest)
return selector, ruleType, ruleName, nil
}

func extractFiltersFromIdRequest(req *minderv1.GetProfileStatusByIdRequest) (*uuid.NullUUID, *sql.NullString, *sql.NullString, error) {
func extractFiltersFromIdRequest(
req *minderv1.GetProfileStatusByIdRequest) (
*uuid.NullUUID, *sql.NullString, *sql.NullString, error) {
if e := req.GetEntity(); e != nil {
if !e.GetType().IsValid() {
return nil, nil, nil, util.UserVisibleError(codes.InvalidArgument,
Expand Down

0 comments on commit 690366f

Please sign in to comment.