github-vet / github-vet/rangeloop-pointer-findings
fromkeith/awsgo: swf/swfhelper/decider.go; 79 LoC
- Dominant language
- No language data
- Stars
- 0
- Forks
- 0
- PR merge metrics
- PR metrics pending
Description
Found a possible issue in [fromkeith/awsgo](https://www.github.com/fromkeith/awsgo) at [swf/swfhelper/decider.go](https://github.com/fromkeith/awsgo/blob/1a1981307d92888f5b7dad66ebc7f101332d8c81/swf/swfhelper/decider.go#L159-L237)
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.
> range-loop variable i used in defer or goroutine at line 171
[Click here to see the code in its original context.](https://github.com/fromkeith/awsgo/blob/1a1981307d92888f5b7dad66ebc7f101332d8c81/swf/swfhelper/decider.go#L159-L237)
Click here to show the 79 line(s) of Go which triggered the analyzer.
```go
for i := range s.history {
if s.history[i].EventType == "ActivityTaskScheduled" {
if s.history[i].ActivityTaskScheduledEventAttributes.ActivityId == thisId {
scheduledEventId = s.history[i].EventId
}
continue
}
if s.history[i].EventType == "ActivityTaskCompleted" {
if s.history[i].ActivityTaskCompletedEventAttributes.ScheduledEventId == scheduledEventId {
go func() {
response <- TaskResult{
activityId: thisId,
Result: s.history[i].ActivityTaskCompletedEventAttributes.Result,
marshaler: s.marshaler,
}
close(response)
}()
return response
}
continue
}
if s.history[i].EventType == "ScheduleActivityTaskFailed" {
if s.history[i].ScheduleActivityTaskFailedEventAttributes.ActivityId == thisId {
go func() {
response <- TaskResult{
activityId: thisId,
FailureType: "ScheduleActivityTaskFailed",
FailureCause: s.history[i].ScheduleActivityTaskFailedEventAttributes.Cause,
}
close(response)
}()
return response
}
continue
}
if s.history[i].EventType == "ActivityTaskCanceled" {
if s.history[i].ActivityTaskCanceledEventAttributes.ScheduledEventId == scheduledEventId {
go func() {
response <- TaskResult{
activityId: thisId,
FailureType: "ActivityTaskCanceled",
FailureCause: s.history[i].ActivityTaskCanceledEventAttributes.Details,
}
close(response)
}()
return response
}
continue
}
if s.history[i].EventType == "ActivityTaskTimedOut" {
if s.history[i].ActivityTaskTimedOutEventAttributes.ScheduledEventId == scheduledEventId {
go func() {
response <- TaskResult{
activityId: thisId,
FailureType: "ActivityTaskTimedOut",
FailureCause: s.history[i].ActivityTaskTimedOutEventAttributes.Details,
}
close(response)
}()
return response
}
continue
}
if s.history[i].EventType == "ActivityTaskFailed" {
if s.history[i].ActivityTaskFailedEventAttributes.ScheduledEventId == scheduledEventId {
go func() {
response <- TaskResult{
activityId: thisId,
FailureType: "ActivityTaskFailed",
FailureCause: s.history[i].ActivityTaskFailedEventAttributes.Details,
FailureReason: s.history[i].ActivityTaskFailedEventAttributes.Reason,
}
close(response)
}()
return response
}
continue
}
}
```
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: 1a1981307d92888f5b7dad66ebc7f101332d8c81
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.