github-vet / github-vet/rangeloop-pointer-findings
communitybridge/easycla: cla-backend-go/v2/cla_groups/service.go; 79 LoC
- Dominant language
- No language data
- Stars
- 0
- Forks
- 0
- PR merge metrics
- PR metrics pending
Description
Found a possible issue in [communitybridge/easycla](https://www.github.com/communitybridge/easycla) at [cla-backend-go/v2/cla_groups/service.go](https://github.com/communitybridge/easycla/blob/232f9d9dcfbccd8531f6feb4c44a62e80490fa07/cla-backend-go/v2/cla_groups/service.go#L740-L818)
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 signatureCompanyIDModel used in defer or goroutine at line 744
[Click here to see the code in its original context.](https://github.com/communitybridge/easycla/blob/232f9d9dcfbccd8531f6feb4c44a62e80490fa07/cla-backend-go/v2/cla_groups/service.go#L740-L818)
Click here to show the 79 line(s) of Go which triggered the analyzer.
```go
for _, signatureCompanyIDModel := range signatureCompanyIDModels {
// Delete any CLA Manager requests
go func(companyID, projectID string) {
log.WithFields(f).Debugf("locating CLA Manager requests for company: %s", signatureCompanyIDModel.CompanyName)
// Fetch any pending CLA manager requests for this company/project
requestList, requestErr := s.claManagerRequests.GetRequests(companyID, projectID)
if requestErr != nil {
log.WithFields(f).Warn(requestErr)
errChan <- requestErr
return
}
// If we have any CLA manager requests - delete them
if requestList != nil && len(requestList.Requests) > 0 {
log.WithFields(f).Debugf("removing %d CLA Manager Requests found for company and project", len(requestList.Requests))
for _, request := range requestList.Requests {
reqDelErr := s.claManagerRequests.DeleteRequest(request.RequestID)
log.WithFields(f).Warn(reqDelErr)
errChan <- reqDelErr
return
}
} else {
log.WithFields(f).Debug("no CLA Manager Requests found for company and project")
}
// No errors - nice...return nil
errChan <- nil
}(signatureCompanyIDModel.CompanyID, claGroupModel.ProjectID)
goRoutineCount++
// For each project associated with the CLA Group...
for _, pID := range projectIDList.List() {
// Remove CLA Manager role
go func(companySFID, projectSFID string, authUser *auth.User) {
log.WithFields(f).Debugf("removing role permissions for %s...", utils.CLAManagerRole)
claMgrErr := oscClient.DeleteRolePermissions(companySFID, projectSFID, utils.CLAManagerRole, authUser)
if claMgrErr != nil {
log.WithFields(f).Warn(claMgrErr)
errChan <- claMgrErr
return
}
// No errors - nice...return nil
errChan <- nil
}(signatureCompanyIDModel.CompanySFID, pID, authUser)
goRoutineCount++
// Remove CLA Manager Designee
go func(companySFID, projectSFID string, authUser *auth.User) {
log.WithFields(f).Debugf("removing role permissions for %s...", utils.CLADesigneeRole)
claMgrDesigneeErr := oscClient.DeleteRolePermissions(companySFID, projectSFID, utils.CLADesigneeRole, authUser)
if claMgrDesigneeErr != nil {
log.WithFields(f).Warn(claMgrDesigneeErr)
errChan <- claMgrDesigneeErr
return
}
// No errors - nice...return nil
errChan <- nil
}(signatureCompanyIDModel.CompanySFID, pID, authUser)
goRoutineCount++
// Remove CLA signatories role
go func(companySFID, projectSFID string, authUser *auth.User) {
log.WithFields(f).Debugf("removing role permissions for %s...", utils.CLASignatoryRole)
claSignatoryErr := oscClient.DeleteRolePermissions(companySFID, projectSFID, utils.CLASignatoryRole, authUser)
if claSignatoryErr != nil {
log.WithFields(f).Warn(claSignatoryErr)
errChan <- claSignatoryErr
return
}
// No errors - nice...return nil
errChan <- nil
}(signatureCompanyIDModel.CompanySFID, pID, authUser)
goRoutineCount++
}
}
```
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: 232f9d9dcfbccd8531f6feb4c44a62e80490fa07
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.