github-vet / github-vet/rangeloop-pointer-findings
swiftycloud/swifty: src/s3/data.go; 56 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/data.go](https://github.com/swiftycloud/swifty/blob/611fe46e98f94cf727ffe89b461ac44607be75df/src/s3/data.go#L235-L290)
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.
>
[Click here to see the code in its original context.](https://github.com/swiftycloud/swifty/blob/611fe46e98f94cf727ffe89b461ac44607be75df/src/s3/data.go#L235-L290)
Click here to show the 56 line(s) of Go which triggered the analyzer.
```go
for _, objp := range objps {
var object s3mgo.Object
var bucket s3mgo.Bucket
log.Debugf("s3: Detected stale object data %s", infoLong(&objp))
query_ref := bson.M{ "_id": objp.RefID }
err = dbS3FindOne(ctx, query_ref, &object)
if err != nil {
if err != mgo.ErrNotFound {
log.Errorf("s3: Can't find object on data %s: %s",
infoLong(&objp), err.Error())
return err
}
} else {
query_bucket := bson.M{ "_id": object.BucketObjID }
err = dbS3FindOne(ctx, query_bucket, &bucket)
if err != nil {
if err != mgo.ErrNotFound {
log.Errorf("s3: Can't find bucket on object %s: %s",
infoLong(&object), err.Error())
return err
}
} else {
err = s3DirtifyBucket(ctx, bucket.ObjID)
if err != nil {
if err != mgo.ErrNotFound {
log.Errorf("s3: Can't dirtify bucket on object %s: %s",
infoLong(&bucket), err.Error())
return err
}
}
}
if err = dbS3Remove(ctx, &object); err != nil {
if err != mgo.ErrNotFound {
log.Errorf("s3: Can't remove object on data %s: %s",
infoLong(&objp), err.Error())
return err
}
}
log.Debugf("s3: Removed object on data %s: %s", infoLong(&objp), err.Error())
}
DeleteChunks(ctx, &objp)
err = dbS3Remove(ctx, &objp)
if err != nil {
log.Debugf("s3: Can't remove object data %s", infoLong(&objp))
return err
}
log.Debugf("s3: Removed stale object data %s", infoLong(&objp))
}
```
Click here to show extra information the analyzer produced.
```
No path was found through the callgraph that could lead to a function which writes a pointer argument.
No path was found through the callgraph that could lead to a function which passes a pointer to third-party code.
root signature {infoLong 1} was not found in the callgraph; reference was passed directly to third-party code
```
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
Assessment
This issue has not been assessed yet.