github-vet / github-vet/rangeloop-pointer-findings
swiftycloud/swifty: src/s3/object.go; 20 LoC
- Dominant language
- No language data
- Stars
- 0
- Forks
- 0
- PR merge metrics
- PR metrics pending
Description
Found a possible issue in [swiftycloud/swifty](https://www.github.com/swiftycloud/swifty) at [src/s3/object.go](https://github.com/swiftycloud/swifty/blob/611fe46e98f94cf727ffe89b461ac44607be75df/src/s3/object.go#L43-L62)
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.
> function call at line 44 may store a reference to object
[Click here to see the code in its original context.](https://github.com/swiftycloud/swifty/blob/611fe46e98f94cf727ffe89b461ac44607be75df/src/s3/object.go#L43-L62)
Click here to show the 20 line(s) of Go which triggered the analyzer.
```go
for _, object := range objects {
log.Debugf("s3: Detected stale object %s", infoLong(&object))
if err = s3DeactivateObjectData(ctx, object.ObjID); err != nil {
if err != mgo.ErrNotFound {
log.Errorf("s3: Can't find object data %s: %s",
infoLong(object), err.Error())
return err
}
}
err = dbS3Remove(ctx, &object)
if err != nil {
log.Errorf("s3: Can't delete object %s: %s",
infoLong(&object), err.Error())
return err
}
log.Debugf("s3: Removed stale object %s", infoLong(&object))
}
```
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: 611fe46e98f94cf727ffe89b461ac44607be75df
Contributor guide
No contributing guide indexed for this repository
Research direction
Read src/s3/object.go lines 43-62 and inspect the calls to infoLong, s3DeactivateObjectData, and dbS3Remove in this stale-object loop. Check whether the analyzer's reference warning reflects actual behavior, then verify that stale-object cleanup and its logging remain correct after any fix.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- go
- Domain
- backend
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100