github-vet / github-vet/rangeloop-pointer-findings

fission/fission-workflows: pkg/controller/invocation.go; 43 LoC

Open
#18,288 0 comments 0 reactions 0 assignees View on GitHub
fresh small
Dominant language
No language data
Stars
0
Forks
0
PR merge metrics
PR metrics pending

Description

Found a possible issue in [fission/fission-workflows](https://www.github.com/fission/fission-workflows) at [pkg/controller/invocation.go](https://github.com/fission/fission-workflows/blob/98ba59979ca7dd6d7600e43a258932bcae8786ba/pkg/controller/invocation.go#L679-L721)

Below is the message reported by the analyzer for this snippet of code. Beware that the analyzer only reports the first issue it finds, so please do not limit your consideration to the contents of the below message.

> reference to aggregate was used in a composite literal at line 716

[Click here to see the code in its original context.](https://github.com/fission/fission-workflows/blob/98ba59979ca7dd6d7600e43a258932bcae8786ba/pkg/controller/invocation.go#L679-L721)

Click here to show the 43 line(s) of Go which triggered the analyzer.

```go
for _, aggregate := range s.invocations.List() {
// Ignore non-workflow entities in workflow store
if aggregate.Type != types.TypeInvocation {
logrus.Warnf("Non-invocation entity in invocations store: %v", aggregate)
continue
}

// Try to get the most recent workflow
if refresher, ok := s.invocations.CacheReader.(fes.CacheRefresher); ok {
refresher.Refresh(aggregate)
} else {
logrus.Warnf("Cache does not support refreshing (key: %v)", aggregate.Format())
}

// Get actual workflow
wf, err := s.invocations.GetInvocation(aggregate.GetId())
if err != nil {
logrus.Warnf("Could not retrieve entity from invocations store: %v", aggregate)
continue
}

// Check if the status is not in a terminal state
switch wf.GetStatus().GetStatus() {
case types.WorkflowInvocationStatus_ABORTED, types.WorkflowInvocationStatus_FAILED, types.WorkflowInvocationStatus_SUCCEEDED:
continue
default:
// nop
}

// Submit evaluation for the workflow invocation
// The workqueue within in the control system ensures that invocations that are already queued for execution
// will be ignored.
evalQueue.Submit(&ctrl.Event{
Old: wf,
Updated: wf,
Event: &fes.Event{
Type: EventRefresh,
Aggregate: &aggregate,
Timestamp: ptypes.TimestampNow(),
},
Aggregate: aggregate,
})
}

```

Leave a reaction on this issue to contribute to the project by classifying this instance as a **Bug** :-1:, **Mitigated** :+1:, or **Desirable Behavior** :rocket:
See the descriptions of the classifications [here](https://github.com/github-vet/rangeclosure-findings#how-can-i-help) for more information.

commit ID: 98ba59979ca7dd6d7600e43a258932bcae8786ba

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.